After deserializing a following class:
static class WrapperWithFeatures {
@JsonFormat(without = JsonFormat.Feature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)
public ZonedDateTime value;
public WrapperWithFeatures() { }
public WrapperWithFeatures(ZonedDateTime v) { value = v; }
}
value field should preserve timezone from the source - but it doesn't. Following test fails:
@Test
public void testDeserializationWithZonePreserved() throws Throwable
{
WrapperWithFeatures wrapper = JsonMapper.builder()
.addModule(new JavaTimeModule())
.build()
.readerFor(WrapperWithFeatures.class)
.readValue("{\"value\":\"2000-01-01T12:00+01:00\"}");
assertEquals("Timezone should be preserved.",
ZonedDateTime.of(2000, 1, 1, 12, 0, 0 ,0, ZoneOffset.ofHours(1)),
wrapper.value);
}