aboutsummaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2021-12-30 19:13:13 -0600
committerIván Ávalos <avalos@disroot.org>2021-12-30 19:13:13 -0600
commitc11d9d0aaa0428e93df978642a54ba466ccf4e93 (patch)
treec31c1af4d1e1fb724f1309f5f9b765e805e81832 /shared
parent512e01c0ca36b336b3dc6437c6fb326614d020d0 (diff)
downloadetbsa-trackermap-mobile-c11d9d0aaa0428e93df978642a54ba466ccf4e93.tar.gz
etbsa-trackermap-mobile-c11d9d0aaa0428e93df978642a54ba466ccf4e93.tar.bz2
etbsa-trackermap-mobile-c11d9d0aaa0428e93df978642a54ba466ccf4e93.zip
Implemented datetime formatting
Diffstat (limited to 'shared')
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Position.kt6
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/Formatter.kt12
2 files changed, 15 insertions, 3 deletions
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Position.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Position.kt
index 9a16615..5286b46 100644
--- a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Position.kt
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/models/Position.kt
@@ -46,11 +46,11 @@ data class Position (
val deviceId: Int? = null,
val protocol: String? = null,
/* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */
-// val deviceTime: LocalDateTime? = null,
+ val deviceTime: String? = null,
/* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */
-// val fixTime: LocalDateTime? = null,
+ val fixTime: String? = null,
/* in IS0 8601 format. eg. `1963-11-22T18:30:00Z` */
-// val serverTime: LocalDateTime? = null,
+ val serverTime: String? = null,
val outdated: Boolean? = null,
val valid: Boolean? = null,
val latitude: Double? = null,
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/Formatter.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/Formatter.kt
new file mode 100644
index 0000000..133c028
--- /dev/null
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/utils/Formatter.kt
@@ -0,0 +1,12 @@
+package mx.trackermap.TrackerMap.utils
+
+import kotlinx.datetime.*
+
+class Formatter {
+ companion object {
+ fun formatDate(date: String): String {
+ return date.substring(0 until date.indexOf('+'))
+ .toLocalDateTime().toString().replace('T', ' ')
+ }
+ }
+} \ No newline at end of file