All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.metadude.kotlin.library.engelsystem.adapters.ZonedDateTimeAdapter.kt Maven / Gradle / Ivy

There is a newer version: 9.2.0
Show newest version
package info.metadude.kotlin.library.engelsystem.adapters

import com.squareup.moshi.FromJson
import org.threeten.bp.DateTimeException
import org.threeten.bp.ZonedDateTime

class ZonedDateTimeAdapter {

    @FromJson
    fun fromJson(jsonValue: String?) = jsonValue?.let {
        try {
            ZonedDateTime.parse(jsonValue)
        } catch (e: DateTimeException) {
            println(e.message)
            null
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy