- with the extra Z at the end. Do I need to change all my
LocalDateTime
to
Instant
? Or write my own serializer? Seems a little bit of unnecessary work 😞 Or should I just hack it and chop off the 'Z' before posting my Json from the front end?
c
CLOVIS
02/20/2023, 10:12 PM
Instant and LocalDateTime are very different things, and you should be very careful not to mix them...
JavaScript's
Date
class is an
Instant
.
v
v79
02/20/2023, 10:18 PM
I thought that might be the case. Is there a consensus on the right approach? I don't do much web development any more.
c
CLOVIS
02/21/2023, 8:30 AM
Well it depends what you want. If you want a local date time, use
LocalDateTime
on the Kotlin side, and do not use
Date
on the JS side. If you want a UTC date time, use
Instant
on the Kotlin side and
Date
on the JS side.
v
v79
02/21/2023, 9:07 AM
I am over thinking it. These are timestamps, so Long will be sufficient, or Instant.