diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-02-18 17:10:10 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-02-18 17:10:10 +0100 |
commit | 667b3f983a3a77865e4fb89c0cf531ce982904ac (patch) | |
tree | a65572ca6ee9ee728d8fbe8b50bc18d866316cfb /src | |
parent | 29f0867506334d0f7387f654e7d84b6840a1ad86 (diff) | |
download | kvision-667b3f983a3a77865e4fb89c0cf531ce982904ac.tar.gz kvision-667b3f983a3a77865e4fb89c0cf531ce982904ac.tar.bz2 kvision-667b3f983a3a77865e4fb89c0cf531ce982904ac.zip |
Make kvision-remote module independent of kvision itself.
Change the default JSON serialization format of Date objects (plain long value).
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/form/Form.kt | 3 | ||||
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/types/Date.kt | 6 |
2 files changed, 3 insertions, 6 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/form/Form.kt b/src/main/kotlin/pl/treksoft/kvision/form/Form.kt index ccd6363b..983b83e5 100644 --- a/src/main/kotlin/pl/treksoft/kvision/form/Form.kt +++ b/src/main/kotlin/pl/treksoft/kvision/form/Form.kt @@ -30,7 +30,6 @@ import kotlinx.serialization.serializer import pl.treksoft.kvision.i18n.I18n.trans import pl.treksoft.kvision.types.DateSerializer import pl.treksoft.kvision.types.KFile -import pl.treksoft.kvision.types.KV_JSON_DATE_FORMAT import pl.treksoft.kvision.types.toStringF import pl.treksoft.kvision.utils.JSON import pl.treksoft.kvision.utils.getContent @@ -91,7 +90,7 @@ class Form<K : Any>(private val panel: FormPanel<K>? = null, private val seriali val map = it.flatMap { entry -> when (entry.value) { is Date -> { - listOf(entry.key to (entry.value as? Date)?.toStringF(KV_JSON_DATE_FORMAT)) + listOf(entry.key to (entry.value as? Date)?.toStringF()) } is List<*> -> { @Suppress("UNCHECKED_CAST") diff --git a/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/src/main/kotlin/pl/treksoft/kvision/types/Date.kt index 153003ab..ffa5008a 100644 --- a/src/main/kotlin/pl/treksoft/kvision/types/Date.kt +++ b/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -31,8 +31,6 @@ import kotlin.js.Date 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 /** @@ -60,10 +58,10 @@ object DateSerializer : KSerializer<Date> { override val descriptor: SerialDescriptor = SerialClassDescImpl("kotlin.js.Date") override fun deserialize(decoder: Decoder): Date { - return decoder.decodeString().toDateF(KV_JSON_DATE_FORMAT) + return decoder.decodeString().toDateF() } override fun serialize(encoder: Encoder, obj: Date) { - encoder.encodeString(obj.toStringF(KV_JSON_DATE_FORMAT)) + encoder.encodeString(obj.toStringF()) } } |