aboutsummaryrefslogtreecommitdiff
path: root/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/Serializer.kt
diff options
context:
space:
mode:
Diffstat (limited to 'shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/Serializer.kt')
-rw-r--r--shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/Serializer.kt18
1 files changed, 18 insertions, 0 deletions
diff --git a/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/Serializer.kt b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/Serializer.kt
new file mode 100644
index 0000000..9caf24f
--- /dev/null
+++ b/shared/src/commonMain/kotlin/mx/trackermap/TrackerMap/client/infrastructure/Serializer.kt
@@ -0,0 +1,18 @@
+package mx.trackermap.TrackerMap.client.infrastructure
+
+import com.squareup.moshi.Moshi
+import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
+import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
+import mx.trackermap.TrackerMap.client.infrastructure.LocalDateAdapter
+import mx.trackermap.TrackerMap.client.infrastructure.LocalDateTimeAdapter
+import java.util.Date
+
+object Serializer {
+ @JvmStatic
+ val moshi: Moshi = Moshi.Builder()
+ .add(KotlinJsonAdapterFactory())
+ .add(Date::class.java, Rfc3339DateJsonAdapter().nullSafe())
+ .add(LocalDateTimeAdapter())
+ .add(LocalDateAdapter())
+ .build()
+} \ No newline at end of file