Dependency Updates
This commit is contained in:
@@ -2,15 +2,18 @@ package com.atridad.mealient.database
|
||||
|
||||
import androidx.room.TypeConverter
|
||||
import kotlinx.datetime.*
|
||||
import kotlin.time.ExperimentalTime
|
||||
|
||||
object RoomTypeConverters {
|
||||
@OptIn(ExperimentalTime::class)
|
||||
@TypeConverter
|
||||
fun localDateTimeToTimestamp(localDateTime: LocalDateTime) =
|
||||
localDateTime.toInstant(TimeZone.UTC).toEpochMilliseconds()
|
||||
|
||||
@OptIn(ExperimentalTime::class)
|
||||
@TypeConverter
|
||||
fun timestampToLocalDateTime(timestamp: Long) =
|
||||
Instant.fromEpochMilliseconds(timestamp).toLocalDateTime(TimeZone.UTC)
|
||||
kotlin.time.Instant.fromEpochMilliseconds(timestamp).toLocalDateTime(TimeZone.UTC)
|
||||
|
||||
@TypeConverter
|
||||
fun localDateToTimeStamp(date: LocalDate) =
|
||||
|
||||
Reference in New Issue
Block a user