Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add converters for java.time.LocalDate, java.time.LocalDateTime, java.time.LocalTime and java.time.ZonedDate #82
Do not integrate yet, as this needs some changes. LocalTime.toString() omits seconds/nanoseconds if they're null, which is optional by the ISO 8601 specification. It makes sense to conform to http://www.w3schools.com/xml/schema_dtypes_date.asp which requires all components of hh:mm:ss to be included in the output.
@mcimbora Could you also add the OffsetDateTime converter too? Not just ES needs them: optaplanner-benchmark replaced a java.util.Date with OffsetDateTime, and this is ugly in the persisted xml:
Btw, I found out the big difference between OffsetDateTime and ZonedDateTime: in databases and files (including xml files), always use OffsetDateTime, because timezone rules change (which corrupts ZonedDateTime). In UI's, use ZonedDateTime (so potentially also in REST services, so there still needs to be an xstream converter).
@joehni Can we also register these java.time converters to XStream to be used by default (so no special config is needed)? This kinda does break backwards compatibility (see xml file above that won't parse afterwards) ... but I think it's the right thing to do (not in a hotfix version, but maybe in a minor version?). Update: looks like this change is already doing that. I still prefer it like that, but you'll want to be aware of the implication...