From 07f9472afaffb3d6187d15eb13368f3b8f3b1b7b Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sat, 19 Jan 2019 01:04:34 +0100 Subject: Add timezone info to the JSON date format. --- src/main/kotlin/pl/treksoft/kvision/types/Date.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/main/kotlin/pl/treksoft') diff --git a/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/src/main/kotlin/pl/treksoft/kvision/types/Date.kt index 7b5acc59..99511dee 100644 --- a/src/main/kotlin/pl/treksoft/kvision/types/Date.kt +++ b/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -29,7 +29,9 @@ import kotlinx.serialization.internal.SerialClassDescImpl import pl.treksoft.kvision.KVManager import kotlin.js.Date -actual val KV_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss" +actual val KV_DEFAULT_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss" + +actual val KV_JSON_DATE_FORMAT = "YYYY-MM-DD HH:mm:ssZZ" actual typealias Date = kotlin.js.Date @@ -58,10 +60,10 @@ object DateSerializer : KSerializer { override val descriptor: SerialDescriptor = SerialClassDescImpl("kotlin.js.Date") override fun deserialize(input: Decoder): Date { - return input.decodeString().toDateF() + return input.decodeString().toDateF(KV_JSON_DATE_FORMAT) } override fun serialize(output: Encoder, obj: Date) { - output.encodeString(obj.toStringF()) + output.encodeString(obj.toStringF(KV_JSON_DATE_FORMAT)) } } -- cgit