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

Use TimeZone in DeserializationContext when SerializationFeature.WRITE_DATES_WITH_ZONE_ID is not set #69

Merged
merged 1 commit into from
Jul 16, 2015

Conversation

islanderman
Copy link

Outline

This pull request is to fix #68. It adds a feature to honor TimeZone in DeserializationContext if SerializationFeature.WRITE_DATES_WITH_ZONE_ID is not set.

If timezone format is specified as part of JacksonJodaDateFormat during init time, it will be honored first; otherwise TimeZone in DeserializationContext is used.

I realize this means if JacksonJodaDateFormat is predefined as in constructor/@JsonFormat, TimeZone in DeserializationContext is going to be invalid. However this TimeZone has a default value as . So that there's no way of distinguishing if this is just a default or this TimeZone should be handled specifically.

Fix

There are only three datatypes that are associated with TimeZone:

  1. DateTime
  2. Interval
  3. DateMidnight
DateTimeZone tz = _format.isTimezoneExplicit() ? 
    _format.getTimeZone() : DateTimeZone.forTimeZone(ctxt.getTimeZone());

Also add additional unit test cases for TimeZone related features.

@islanderman islanderman changed the title Implement #68 Honor TimeZone in DeserializationContext when SerializationFeature.WRITE_DATES_WITH_ZONE_ID is not set Jul 15, 2015
@islanderman islanderman changed the title Honor TimeZone in DeserializationContext when SerializationFeature.WRITE_DATES_WITH_ZONE_ID is not set Use TimeZone in DeserializationContext when SerializationFeature.WRITE_DATES_WITH_ZONE_ID is not set Jul 15, 2015
@cowtowncoder
Copy link
Member

Looks good to me, will be happy to merge this in.

At this point we do need the Contributor License Agreemant (from https://github.com/FasterXML/jackson/blob/master/contributor-agreement.pdf) to merge the fix. It's a one-time thing, good for any further contributions.
The usual way is to download, print, fill+sign, scan, email to info at fasterxml dot com. If so, we'll archive CLA, and I can proceed with merging right away.

@islanderman
Copy link
Author

Done. Please merge when you have time. Thanks.

cowtowncoder added a commit that referenced this pull request Jul 16, 2015
Use TimeZone in DeserializationContext when SerializationFeature.WRITE_DATES_WITH_ZONE_ID is not set
@cowtowncoder cowtowncoder merged commit 21b4391 into FasterXML:master Jul 16, 2015
@cowtowncoder cowtowncoder added this to the 2.6. milestone Jul 16, 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

Successfully merging this pull request may close these issues.

TimeZone in DeserializationContext is ignored with SerializationFeature.WRITE_DATES_WITH_ZONE_ID
2 participants