Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust LocalDate / LocalDateTime deserializer to support DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE #71

Closed
nezda opened this issue Aug 22, 2015 · 0 comments
Milestone

Comments

@nezda
Copy link
Contributor

nezda commented Aug 22, 2015

When deserializing from a long, UTC should be specified to be in keeping with

http://wiki.fasterxml.com/JacksonFAQDateHandling

  • 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.

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

@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));
  }
nezda added a commit to nezda/jackson-datatype-joda that referenced this issue Aug 26, 2015
@nezda nezda mentioned this issue Aug 26, 2015
cowtowncoder added a commit that referenced this issue Sep 15, 2015
@cowtowncoder cowtowncoder modified the milestones: 2.3.1, 2.6.2 Sep 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants