-
Notifications
You must be signed in to change notification settings - Fork 117
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
Allow LocalDate
to be serialized/deserialized as number (epoch day)
#20
Comments
If there is indeed variant to convert to/from |
Yep, both serialization and deserialization should be supported, and using I've forked the repo to try to work on this myself but the build fails with missing poms, is there a specific layout that's needed for building? |
@kewne in my experience, clone the jackson-bom repo, run |
@kevinjom Got it working, thanks! @cowtowncoder I'm looking through the code but I'm having difficulty understanding the rationale behind some of the formatting: some zeroes are added to the fractional part of the result "to avoid interpretation as integral number". |
…r (epoch day)
@kewne excellent! I did not write this module originally, so some of the logic predates my changes. I don't recall part about additional zeroes, which should not be necessary to just differentiate between JSON integers vs floating-point numbers. |
As per notes on PR, will merge as soon as we get CLA; will make it in 2.9(.0.pr3) |
#20 Allow `LocalDate` to be serialized/deserialized as number (epoch day)
The
LocalDateSerializer
only supports serializingLocalDate
instances as strings or arrays, both of which suffer from localization issues ("is it year-month-day or year-day-month?").An alternative would be to use
LocalDate#toEpochDay()
andLocalDate#ofEpochDay(long)
, thus allowing a (less human readable but) unambiguous format.The text was updated successfully, but these errors were encountered: