Jackson defaults to GMT/UTC ("How come this time is off by 9 hours?")
To be even more flexible, the DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE feature I wasn't aware of could be mapped from and utilized here too.
I'm currently "working around" this with DateTimeZone.setDefault(DateTimeZone.UTC); but this is problematic.
Test case: timestamp 1238544000000L in my timezone is 3/31/2009 but 4/1/2009 in UTC
@Test
public void aprilFools() {
final long aprilFools = 1238544000000L;
System.err.println("date "+new LocalDate(aprilFools));
System.err.println("UTC date "+new LocalDate(aprilFools, DateTimeZone.UTC));
}
When deserializing from a
long
, UTC should be specified to be in keeping withTo be even more flexible, the
DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE
feature I wasn't aware of could be mapped from and utilized here too.Looks like similar approach to #29 would work https://github.com/FasterXML/jackson-datatype-joda/blob/master/src/main/java/com/fasterxml/jackson/datatype/joda/deser/LocalDateDeserializer.java#L40
I'm currently "working around" this with
DateTimeZone.setDefault(DateTimeZone.UTC);
but this is problematic.Test case: timestamp 1238544000000L in my timezone is 3/31/2009 but 4/1/2009 in UTC