aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-01-19 01:04:34 +0100
committerRobert Jaros <rjaros@finn.pl>2019-01-19 01:04:34 +0100
commit07f9472afaffb3d6187d15eb13368f3b8f3b1b7b (patch)
tree750e5d43149a1e86d1842a976ffccb2efe71adb4 /src/main/kotlin/pl/treksoft
parent9d2cbb456840e649edb263f7ee90eca5fab2cfb4 (diff)
downloadkvision-07f9472afaffb3d6187d15eb13368f3b8f3b1b7b.tar.gz
kvision-07f9472afaffb3d6187d15eb13368f3b8f3b1b7b.tar.bz2
kvision-07f9472afaffb3d6187d15eb13368f3b8f3b1b7b.zip
Add timezone info to the JSON date format.
Diffstat (limited to 'src/main/kotlin/pl/treksoft')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/types/Date.kt8
1 files changed, 5 insertions, 3 deletions
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<Date> {
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))
}
}