diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-02-18 19:12:10 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-02-18 19:12:10 +0100 |
commit | 5178fc613b673367ceef2e907cda7c6386f7ac40 (patch) | |
tree | 5f600c8b7aa129853dd61b3732885550a4aea7d1 /src/main/kotlin/pl/treksoft/kvision | |
parent | 07ef074ccc18f58aabb0714407d97db59a8897b5 (diff) | |
download | kvision-5178fc613b673367ceef2e907cda7c6386f7ac40.tar.gz kvision-5178fc613b673367ceef2e907cda7c6386f7ac40.tar.bz2 kvision-5178fc613b673367ceef2e907cda7c6386f7ac40.zip |
Simplifications for multiplatform Date type.
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/types/Date.kt | 6 |
1 files changed, 3 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 ffa5008a..4feaa181 100644 --- a/src/main/kotlin/pl/treksoft/kvision/types/Date.kt +++ b/src/main/kotlin/pl/treksoft/kvision/types/Date.kt @@ -29,7 +29,7 @@ import kotlinx.serialization.internal.SerialClassDescImpl import pl.treksoft.kvision.KVManager import kotlin.js.Date -actual val KV_DEFAULT_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss" +val KV_DEFAULT_DATE_FORMAT = "YYYY-MM-DD HH:mm:ss" actual typealias Date = kotlin.js.Date @@ -39,7 +39,7 @@ actual typealias Date = kotlin.js.Date * @return Date object */ @Suppress("UnsafeCastFromDynamic") -actual fun String.toDateF(format: String): Date { +fun String.toDateF(format: String = KV_DEFAULT_DATE_FORMAT): Date { val result = KVManager.fecha.parse(this, format) return if (result) result else Date() } @@ -50,7 +50,7 @@ actual fun String.toDateF(format: String): Date { * @return String object */ @Suppress("UnsafeCastFromDynamic") -actual fun Date.toStringF(format: String): String { +fun Date.toStringF(format: String = KV_DEFAULT_DATE_FORMAT): String { return KVManager.fecha.format(this, format) } |