mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
fix: use safe date conversion for database converters
This commit is contained in:
parent
ed4f65eb92
commit
235f7f9796
@ -2,18 +2,18 @@ package com.github.libretube.db
|
|||||||
|
|
||||||
import androidx.room.TypeConverter
|
import androidx.room.TypeConverter
|
||||||
import com.github.libretube.api.JsonHelper
|
import com.github.libretube.api.JsonHelper
|
||||||
|
import com.github.libretube.extensions.toLocalDateSafe
|
||||||
|
import kotlinx.datetime.LocalDate
|
||||||
|
import kotlinx.serialization.encodeToString
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import kotlin.io.path.Path
|
import kotlin.io.path.Path
|
||||||
import kotlinx.datetime.LocalDate
|
|
||||||
import kotlinx.datetime.toLocalDate
|
|
||||||
import kotlinx.serialization.encodeToString
|
|
||||||
|
|
||||||
object Converters {
|
object Converters {
|
||||||
@TypeConverter
|
@TypeConverter
|
||||||
fun localDateToString(localDate: LocalDate?) = localDate?.toString()
|
fun localDateToString(localDate: LocalDate?) = localDate?.toString()
|
||||||
|
|
||||||
@TypeConverter
|
@TypeConverter
|
||||||
fun stringToLocalDate(string: String?) = string?.toLocalDate()
|
fun stringToLocalDate(string: String?) = string?.toLocalDateSafe()
|
||||||
|
|
||||||
@TypeConverter
|
@TypeConverter
|
||||||
fun pathToString(path: Path?) = path?.toString()
|
fun pathToString(path: Path?) = path?.toString()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user