make date converter null safe (#3006)
This commit is contained in:
parent
48ad2f9eee
commit
864e72d6f3
1 changed files with 4 additions and 4 deletions
|
@ -126,13 +126,13 @@ class Converters @Inject constructor (
|
|||
}
|
||||
|
||||
@TypeConverter
|
||||
fun dateToLong(date: Date): Long {
|
||||
return date.time
|
||||
fun dateToLong(date: Date?): Long? {
|
||||
return date?.time
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun longToDate(date: Long): Date {
|
||||
return Date(date)
|
||||
fun longToDate(date: Long?): Date? {
|
||||
return date?.let { Date(it) }
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
|
|
Loading…
Reference in a new issue