aboutsummaryrefslogtreecommitdiff
path: root/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/LocalDateAdapter.kt
blob: 6b73b6084a7411a79e0e23890c8839db031ecf40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package mx.trackermap.TrackerMap.client.infrastructure

import java.time.LocalDate
import java.time.format.DateTimeFormatter

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

    fun fromJson(value: String): LocalDate {
        return LocalDate.parse(value, DateTimeFormatter.ISO_LOCAL_DATE_TIME)
    }
}