-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Do not use deprecated jackson iso8601 class #2423
Do not use deprecated jackson iso8601 class #2423
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@@ -30,7 +30,9 @@ public static Integer toInt(QueryParameter parameter) { | |||
|
|||
public static Date toDate(QueryParameter parameter) { | |||
try { | |||
return parameter.isPresent() ? new ISO8601DateFormat().parse(parameter.firstValue()) : null; | |||
return parameter.isPresent() | |||
? new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(parameter.firstValue()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we changing the contract here?
I think the class we're replacing will allow milliseconds whereas it looks like this won't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah fair point, I looked upon the usages and based myself upon the usage for ParseDateHelper which does not use ms. Do you prefer a singular contract or optional ms?
How about we use i.e. for formatting: DateTimeFormatter.ISO_ZONED_DATE_TIME.format(date.toInstant().atZone(ZoneId.of('Z'))); parsing: Date.from(ZonedDateTime.parse(isoDateTimeString).toInstant()) |
The currently used Jackson ISO8601 class is deprecated
References
Submitter checklist
#help-contributing
or a project-specific channel like#wiremock-java