aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kvision-modules/kvision-common-types/src/main/kotlin/pl/treksoft/kvision/types/Date.kt6
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt3
-rw-r--r--kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/types/Date.kt2
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt3
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/types/Date.kt2
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/types/Date.kt2
6 files changed, 14 insertions, 4 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 86a72b33..b76e89ca 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,8 +21,10 @@
*/
package pl.treksoft.kvision.types
+expect val KV_DATE_FORMAT: String
+
expect class Date
-expect fun String.toDateF(format: String = "YYYY-MM-DD HH:mm:ss"): Date
+expect fun String.toDateF(format: String = KV_DATE_FORMAT): Date
-expect fun Date.toStringF(format: String = "YYYY-MM-DD HH:mm:ss"): String
+expect fun Date.toStringF(format: String = KV_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 79a02e87..05681349 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
@@ -25,6 +25,7 @@ import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import org.jooby.Kooby
import org.jooby.json.Jackson
import org.pac4j.core.profile.CommonProfile
+import pl.treksoft.kvision.types.KV_DATE_FORMAT
import java.text.SimpleDateFormat
import kotlinx.coroutines.async as coroutinesAsync
@@ -38,7 +39,7 @@ actual open class KVServer(init: KVServer.() -> Unit) : Kooby() {
@Suppress("LeakingThis")
assets("/**").onMissing(0)
val mapper = jacksonObjectMapper().apply {
- dateFormat = SimpleDateFormat("YYYY-MM-DD HH:mm:ss")
+ dateFormat = SimpleDateFormat(KV_DATE_FORMAT)
}
@Suppress("LeakingThis")
use(Jackson(mapper))
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 32c8923e..8ce8cbd4 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,6 +29,8 @@ 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 typealias Date = java.util.Date
actual fun String.toDateF(format: String): Date = SimpleDateFormat(format).parse(this)
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 45c5c565..24c6c9db 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,6 +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 java.text.SimpleDateFormat
import javax.servlet.http.HttpServletResponse
import kotlin.reflect.KClass
@@ -48,7 +49,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
val optionsRequests: MutableMap<String, (Request, HttpServletResponse) -> Unit> = mutableMapOf()
val mapper = jacksonObjectMapper().apply {
- dateFormat = SimpleDateFormat("YYYY-MM-DD HH:mm:ss")
+ dateFormat = SimpleDateFormat(KV_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 32c8923e..8ce8cbd4 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,6 +29,8 @@ 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 typealias Date = java.util.Date
actual fun String.toDateF(format: String): Date = SimpleDateFormat(format).parse(this)
diff --git a/src/main/kotlin/pl/treksoft/kvision/types/Date.kt b/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
index b6b60d5c..7b5acc59 100644
--- a/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/types/Date.kt
@@ -29,6 +29,8 @@ 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 typealias Date = kotlin.js.Date
/**