You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi folks, i'm trying to get interop between joda and java.time while i try to switch over to java.time. So currently we have a bajillion pojos that hold joda DateTimes that get serialized to ISO strings to the browser.
I'd like to start incrementally switching that over to LocalDateTime for some of them. When i add the JavaTimeModule,
m_mapper.registerModule(new JavaTimeModule());
i see that the nano part of the date is written to the date string as well, which is not what our current Joda serializer does, so
I'm asking to see how to configure the JavaTimeModule to not write the nano time, from what i can tell it's just picks a static one, but perhaps i missed something??
return DateTimeFormatter.ISO_LOCAL_DATE_TIME;
The text was updated successfully, but these errors were encountered:
One thing is that a recommended approach would be to add "config override" for type LocalDateTime.class instead of constructing deserializer explicitly.
From tests, it's something like:
ObjectMapper m = mapperBuilder().withConfigOverride(LocalDateTime.class,
cfg -> cfg.setFormat(JsonFormat.Value.forPattern("yyyy-MM-dd'X'HH:mm")))
.build();
and is basically more robust way, in case LocalDateTimeSerializer implementation changed.
Hi folks, i'm trying to get interop between joda and java.time while i try to switch over to java.time. So currently we have a bajillion pojos that hold joda DateTimes that get serialized to ISO strings to the browser.
I'd like to start incrementally switching that over to LocalDateTime for some of them. When i add the JavaTimeModule,
i see that the nano part of the date is written to the date string as well, which is not what our current Joda serializer does, so
I'm asking to see how to configure the JavaTimeModule to not write the nano time, from what i can tell it's just picks a static one, but perhaps i missed something??
The text was updated successfully, but these errors were encountered: