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_DATES_TO_CONTEXT_TIME_ZONE got wrong result when parse string contains zone id #93

Closed
chanjarster opened this issue Jul 19, 2017 · 2 comments
Milestone

Comments

@chanjarster
Copy link
Contributor

chanjarster commented Jul 19, 2017

Version: 2.8.8

  public static class Foo {

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private DateTime jodaDateTime;

    public DateTime getJodaDateTime() {
      return jodaDateTime;
    }

    public void setJodaDateTime(DateTime jodaDateTime) {
      this.jodaDateTime = jodaDateTime;
    }
  }

  private static void main(String[] args) throws IOException {

    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.registerModule(new JodaModule());
    objectMapper.enable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE);

    System.out.println(objectMapper.readValue("{\"jodaDateTime\":\"2017-01-01 01:01:01[Asia/Shanghai]\"}", Foo.class).getJodaDateTime());

  }

The input param is "2017-01-01 01:01:01[Asia/Shanghai]", but the result is 2017-01-01T09:01:01.000+08:00. The correct result should be 2017-01-01 01:01:01.000Z.

@cowtowncoder
Copy link
Member

Thank you for reporting this. It does seem like incorrect handling.

Would it be possible to check if this also occurs in 2.9.0.pr4? (I can do that when I get a chance to look into this but that may take a while due to backlog).

@chanjarster
Copy link
Contributor Author

I have tried on 2.9.0.pr4,the result is also wrong

chanjarster added a commit to chanjarster/jackson-datatype-joda that referenced this issue Jul 20, 2017
cowtowncoder added a commit that referenced this issue Jul 24, 2017
@cowtowncoder cowtowncoder added this to the 2.9.0 milestone Jul 24, 2017
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