Hello, is it recommended to use GMTDate in multipl...
# multiplatform
e
Hello, is it recommended to use GMTDate in multiplatform projects?? Since kotlinx-datetime still did not implement formatting features!
g
If you only need support for Datetime in mobile, you could use our library Kaluga: https://github.com/splendo/kaluga/tree/develop/base
It supports formatting/parsing and localization
h
Just use the platform specific formatters
e
So I give my presentation model date as string and in every platform I do formatting
h
No, use Instant from kotlinx-datetime. You only need the formatter/formatting for interacting with the users, eg in Swift, so use the platform native formatters for displaying/input but Instant in your Kotlin business logic code
e
cause in my app I am building a calendar using java.time library using localdate and localdatetime
So I will transform Instant to LocalDateTime?
h
Yeah, for example
e
So my presenter model will be Instant and formatting it inside the UI
data model is string
h
Yeah, but I still don't get it why you want to use a string in your data model
e
domain model should be date instant also
data model is the response from the server
h
Ah okay. If the response uses ISO 8601 you can use kotlinx serialization and
Instant
too
Or write your own serializer, if you want
e
Copy code
"2022-10-18 08:30:00" server response
h
That's not iso 8601 but you simple could use
replace(" ", "T")
or change the response if you control the server
e
okay thank you!!