aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/pl/treksoft/kvision/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/utils')
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt b/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt
index e2396868..b426e432 100644
--- a/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/utils/Utils.kt
@@ -3,7 +3,9 @@
package pl.treksoft.kvision.utils
import pl.treksoft.kvision.core.CssSize
+import pl.treksoft.kvision.core.KVManager
import pl.treksoft.kvision.core.UNIT
+import kotlin.js.Date
fun Int.px(): CssSize = Pair(this, UNIT.px)
fun Int.em(): CssSize = Pair(this, UNIT.em)
@@ -34,3 +36,13 @@ fun Int.toHexString(): String {
}
return result
}
+
+@Suppress("UnsafeCastFromDynamic")
+fun String.toDateF(format: String = "YYYY-MM-DD HH:mm:ss"): Date {
+ return KVManager.fecha.parse(this, format)
+}
+
+@Suppress("UnsafeCastFromDynamic")
+fun Date.toStringF(format: String = "YYYY-MM-DD HH:mm:ss"): String {
+ return KVManager.fecha.format(this, format)
+}