https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
a

Archie

03/17/2020, 7:55 AM
Hi, may I ask how I should deal with Date Serialization in Ktor? Is there an equivalent "LocalDate" or "LocalDateTime" in KMP? If not, how do you guys deal with date?
d

dambakk

03/17/2020, 7:58 AM
I am also interested in this question. Currently we expose the timestamp as long and let the clients convert it to platform specific date types
Oh, wait, you asked about Date serialization 😓 I have no input on that, other than that there exists no Date class in KMP - yet (it is in progress)
a

Archie

03/17/2020, 8:02 AM
hm.. how do you do it though? Do you simple use String instead for Dates?
d

dambakk

03/17/2020, 8:18 AM
No, inside the KMP module I use Klock
😮 1
m

Marc Knaup

03/17/2020, 9:04 AM
I’ve started working on https://github.com/fluidsonic/fluid-time It only has a subset of
java.time
functionality, is mostly a wrapper, needs some API cleanup and supports only Java and iOS so far. Contributions welcome 😄 Example: https://github.com/fluidsonic/fluid-time/blob/master/sources/common/LocalDateTime.kt
😮 1
a

Archie

03/17/2020, 9:15 AM
Thanks guys.. gonna check on both of those libraries... ❤️
r

russhwolf

03/17/2020, 1:24 PM
Or you could just use strings (ISO-8601 format is probably best) in your shared code and translate them via platform-specific APIs at the UI layer
9 Views