FasterXML / jackson-datatype-joda

Extension module to properly support full datatype set of Joda datetime library
Apache License 2.0
140 stars 82 forks source link

`JsonFormat` timezone attribute effect overwritten if pattern attribute present #98

Open gviczai opened 6 years ago

gviczai commented 6 years ago

In JacksonJodaDateFormat:

public JacksonJodaDateFormat with(JsonFormat.Value ann) {
        JacksonJodaDateFormat format = this;
        format = format.withLocale(ann.getLocale());
        format = format.withTimeZone(ann.getTimeZone());
        format = format.withFormat(ann.getPattern().trim());

The withFormat() call overwrites the DateTimeFormatter created by withTimeZone() call. So the resulting object in the _formatter field of JacksonJodaDateFormat will have the iZone field value set to null.

cowtowncoder commented 6 years ago

Hmmh. This may be tricky one, due to tight coupling of format and timezone by JDK. But I'll have a look. Thank you for reporting this.

cowtowncoder commented 5 years ago

Seems like new contributor friendly, will label as such.

cowtowncoder commented 4 years ago

I just realized that I would need a test case here to see what the problem is: description is not enough to see what is going wrong.

cowtowncoder commented 4 years ago

I think this might still be doable, wrt investigation: description suggests how to possibly create the unit test.