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

com.svix.kotlin.internal.infrastructure.LocalDateAdapter.kt Maven / Gradle / Ivy

package com.svix.kotlin.internal.infrastructure

import com.squareup.moshi.FromJson
import com.squareup.moshi.ToJson
import java.time.LocalDate
import java.time.format.DateTimeFormatter

class LocalDateAdapter {
    @ToJson
    fun toJson(value: LocalDate): String {
        return DateTimeFormatter.ISO_LOCAL_DATE.format(value)
    }

    @FromJson
    fun fromJson(value: String): LocalDate {
        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE)
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy