aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt8
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt4
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt3
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt4
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt4
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt4
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/types/Date.kt8
7 files changed, 22 insertions, 13 deletions
diff --git a/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index b76e89ca..274bad61 100644
--- a/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -21,10 +21,12 @@
*/
package pl.treksoft.kvision.types
-expect val KV_DATE_FORMAT: String
+expect val KV_DEFAULT_DATE_FORMAT: String
+
+expect val KV_JSON_DATE_FORMAT: String
expect class Date
-expect fun String.toDateF(format: String = KV_DATE_FORMAT): Date
+expect fun String.toDateF(format: String = KV_DEFAULT_DATE_FORMAT): Date
-expect fun Date.toStringF(format: String = KV_DATE_FORMAT): String
+expect fun Date.toStringF(format: String = KV_DEFAULT_DATE_FORMAT): String
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
index d447cf28..dd5e2dfd 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
+++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
@@ -26,7 +26,7 @@ import org.jooby.Kooby
import org.jooby.Request
import org.jooby.json.Jackson
import org.pac4j.core.profile.CommonProfile
-import pl.treksoft.kvision.types.KV_DATE_FORMAT
+import pl.treksoft.kvision.types.KV_JSON_DATE_FORMAT
import java.text.SimpleDateFormat
import kotlinx.coroutines.async as coroutinesAsync
@@ -40,7 +40,7 @@ actual open class KVServer(init: KVServer.() -> Unit) : Kooby() {
@Suppress("LeakingThis")
assets("/**").onMissing(0)
val mapper = jacksonObjectMapper().apply {
- dateFormat = SimpleDateFormat(KV_DATE_FORMAT)
+ dateFormat = SimpleDateFormat(KV_JSON_DATE_FORMAT)
}
@Suppress("LeakingThis")
use(Jackson(mapper))
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 63d3b1f3..8035cd49 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -30,6 +30,7 @@ import org.jooby.Request
import org.jooby.Response
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import pl.treksoft.kvision.types.KV_JSON_DATE_FORMAT
import java.text.SimpleDateFormat
import kotlin.reflect.KClass
@@ -44,7 +45,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
protected val routes: MutableList<KVServer.() -> Unit> = mutableListOf()
val mapper = jacksonObjectMapper().apply {
- dateFormat = SimpleDateFormat("YYYY-MM-DD HH:mm:ss")
+ dateFormat = SimpleDateFormat(KV_JSON_DATE_FORMAT)
}
var counter: Int = 0
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index 8ce8cbd4..57853c8b 100644
--- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -29,7 +29,9 @@ import com.github.andrewoma.kwery.mapper.util.camelToLowerUnderscore
import java.sql.Timestamp
import java.text.SimpleDateFormat
-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:ssZ"
actual typealias Date = java.util.Date
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 8513c128..6e8ee86e 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -28,7 +28,7 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import pl.treksoft.kvision.types.KV_DATE_FORMAT
+import pl.treksoft.kvision.types.KV_JSON_DATE_FORMAT
import java.text.SimpleDateFormat
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
@@ -50,7 +50,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
val optionsRequests: MutableMap<String, (HttpServletRequest, HttpServletResponse) -> Unit> = mutableMapOf()
val mapper = jacksonObjectMapper().apply {
- dateFormat = SimpleDateFormat(KV_DATE_FORMAT)
+ dateFormat = SimpleDateFormat(KV_JSON_DATE_FORMAT)
}
var counter: Int = 0
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index 8ce8cbd4..57853c8b 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -29,7 +29,9 @@ import com.github.andrewoma.kwery.mapper.util.camelToLowerUnderscore
import java.sql.Timestamp
import java.text.SimpleDateFormat
-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:ssZ"
actual typealias Date = java.util.Date
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))
}
}