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

Adding support for short form of ISO8601 #107

Merged
merged 3 commits into from Dec 2, 2023

Conversation

carlv-stripe
Copy link
Contributor

I'm currently working with an API that was giving me a date/time field that varies between ISO8601 long form (i.e. with a time value) and ISO8601 short (i.e. just the date) and kept getting this error:

 parsing time "2023-03-31" as "2006-01-02 15:04:05": cannot parse "" as "15"

turned out that the short form of ISO8601 was not implemented as one of the accepted formats for strfmt.ParseDateTime(). This format is used in the example given for the native golang function time.ParseInLocation(), which in turn is the underlying function used to parse the time constants in this package.

This PR adds this format, and modifies the subsequently related tests such that they all pass with the new modifications.

Signed-off-by: Carl Vincent <carlv@stripe.com>
Signed-off-by: Carl Vincent <carlv@stripe.com>
Signed-off-by: Carl Vincent <carlv@stripe.com>
@codecov
Copy link

codecov bot commented Apr 13, 2023

Codecov Report

Merging #107 (f514ed1) into master (7b5538a) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #107   +/-   ##
=======================================
  Coverage   81.48%   81.48%           
=======================================
  Files          12       12           
  Lines        2031     2031           
=======================================
  Hits         1655     1655           
  Misses        297      297           
  Partials       79       79           
Impacted Files Coverage Δ
time.go 89.33% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@casualjim casualjim merged commit 447abe8 into go-openapi:master Dec 2, 2023
9 checks passed
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.

None yet

3 participants