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

StdDateFormat: accept and truncate millis larger than 3 digits #1745

Closed
brenuart opened this issue Aug 21, 2017 · 6 comments
Closed

StdDateFormat: accept and truncate millis larger than 3 digits #1745

brenuart opened this issue Aug 21, 2017 · 6 comments
Milestone

Comments

@brenuart
Copy link
Contributor

Java8 is likely to produce datetimes with nanosecond precision: the millis part may therefore be larger than 3 digits.

Unfortunately, Jackson's StdDateFormat fails to parse datetimes when the so-called millis have more than 3 digits - hence breaking interoperability between systems build upon these two technologies.

Although the standard java.util.Date supports only millis precision, JodaTime accepts datetimes serialized with nano-precision and truncate it to the first three digits. I think it would be nice if the StdDateFormat does the same...

@cowtowncoder
Copy link
Member

I would be open to patch for this. Initially I was concerned about possible confusion between rounding and truncation; but if truncation is the usual default we should go with that.
And so it seems reasonable to allow some amount of leniency here for interoperability.

@brenuart
Copy link
Contributor Author

Need a PR or do you handle it yourself ?

@cowtowncoder
Copy link
Member

@brenuart I can handle it eventually but PR would speed things up (sometimes I fix things quickly, other times take longer hard to know). If you want to do PR that'd be great -- I think this is for 2.9 only. I can do quick review and merge.

@brenuart
Copy link
Contributor Author

brenuart commented Aug 22, 2017

I know how hard it is to maintain such an OSS project ;-)
I'll try to find an hour or two in the next couple of days to submit a PR for this...

BTW, why do you say "this is for 2.9 only"? Do you have plans to get rid of StdDateFormat in the next major releases ?

@cowtowncoder
Copy link
Member

@brenuart What I meant is that 2.9 has rewritten version, so earlier branches would need separate patch (no objections to that, just bit more work -- and not sure how many releases of 2.8.x will be made).
No plans to eliminate StdDateFormat at this point, although 2.9 may well be last 2.x version (followed by 3.0).

@cowtowncoder
Copy link
Member

Now allowing up to 9 digits -- can change, or even remove limit, but I think there's some benefit to sanity checking. But if there is some legit usage to, say, 12 or 15, let me know.

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