diff --git a/source/src/main/java/one/nem/lacerta/source/database/common/DateTypeConverter.java b/source/src/main/java/one/nem/lacerta/source/database/common/DateTypeConverter.java index b5824670..9d2140e2 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/common/DateTypeConverter.java +++ b/source/src/main/java/one/nem/lacerta/source/database/common/DateTypeConverter.java @@ -1,4 +1,16 @@ package one.nem.lacerta.source.database.common; +import androidx.room.TypeConverter; + public class DateTypeConverter { + + @TypeConverter + public static java.util.Date fromTimestamp(Long value) { + return value == null ? null : new java.util.Date(value); + } + + @TypeConverter + public static Long dateToTimestamp(java.util.Date date) { + return date == null ? null : date.getTime(); + } }