diff options
Diffstat (limited to 'kvision-modules/kvision-common')
-rw-r--r-- | kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt (renamed from kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KDate.kt) | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KDate.kt b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt index 0cb1a1f1..86a72b33 100644 --- a/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/KDate.kt +++ b/kvision-modules/kvision-common/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -21,29 +21,8 @@ */ package pl.treksoft.kvision.types -import kotlinx.serialization.Serializable +expect class Date -expect val KDATE_FORMAT: String +expect fun String.toDateF(format: String = "YYYY-MM-DD HH:mm:ss"): Date -/** - * A serializable wrapper for a multiplatform Date type. - */ -@Serializable -data class KDate(val time: Long) { - constructor() : this(now().time) - constructor(str: String) : this(str.toKDateF(KDATE_FORMAT).time) - - override fun toString(): String { - return this.toStringF(KDATE_FORMAT) - } - - companion object { - fun now() = nowDate() - } -} - -expect fun nowDate(): KDate - -expect fun String.toKDateF(format: String): KDate - -expect fun KDate.toStringF(format: String): String +expect fun Date.toStringF(format: String = "YYYY-MM-DD HH:mm:ss"): String |