Hi there. I have a question about using Klock in m...
# korge
p
Hi there. I have a question about using Klock in multiplatform kotlin projects. I have a backend, multiplatform and frontend module with gradle. The backend and fronted use the model from the multiplatform with the kotlinx-serialization-runtime. The backend works as expected but the fronted always came up with error messages like a missing compareTo-function. With Serialization I get Serializer has not been found for type 'DateTimeTz' Example: (Multiplatform)
data class(dates: List<DateTimeTz>)
(Frontend after receiving the objects)
console.log(it.dates[0])
--> Objects look like:
Object { adjusted: 1577667600000, offset: 3600000 }
Error during:
Copy code
console.log(DateFormat("dd.MM.yyyy").format(it.dates[0]))
I just included the implementations for multiplatform, jvm and js. The communication between backend and frontend is via REST. If I remove the serialization, I get error messages like missing compareTo functions.
d
Maybe you have to provide a custom serializer or somwthing. Not worked with klock + kotlinx.serialization yet