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

DateMidnightSerializer doesn't take timezone into account #112

Open msiniy opened 5 years ago

msiniy commented 5 years ago

I've faced a problem with DateMidnightSerializer. It doesn't respect the Timezone from serialization context. I think it's the only class that uses JacksonJodaDateFormat.createFormatterWithLocale
https://github.com/FasterXML/jackson-datatype-joda/blob/e5dc3f5b8b255b879e64b944447765cbdf4c7f3d/src/main/java/com/fasterxml/jackson/datatype/joda/ser/DateMidnightSerializer.java#L55 while the others use JacksonJodaDateFormat.createFormatter https://github.com/FasterXML/jackson-datatype-joda/blob/e5dc3f5b8b255b879e64b944447765cbdf4c7f3d/src/main/java/com/fasterxml/jackson/datatype/joda/ser/DateTimeSerializer.java#L71 and therefore aren't affected.

cowtowncoder commented 4 years ago

From description, I am guessing it might be as simple as adding missing .withOffsetParsed() in there, but I realized that I do not have means to reproduce the issue yet. Would it be possible to add a very simple reproduction here? That way I can see the problem, verify fix & guard against regression going forward.

cowtowncoder commented 3 years ago

Also worth noting: DateMidnight type itself has been deprecated in Joda for years.