go-openapi / strfmt

openapi toolkit common string formats
Apache License 2.0
100 stars 61 forks source link

date time iso8601 should be supported #92

Closed alswl closed 9 months ago

alswl commented 2 years ago

ISO 8601 datetime allow +00:00 for time zone. For example, 2021-11-23T14:29:59+08:00 is legal.

via wikipedia https://en.wikipedia.org/wiki/ISO_8601

So, https://github.com/go-openapi/strfmt/blob/master/time.go#L60 should support this kind of format. And this format is use widely in Java system. So when I using the openapi.json from Java generated specs, it will cause an err:

ERRO[0000] err                                           error="parsing time \"2018-06-26T20:43:50+080:0\": extra text: \":50+0800\"" resp="<nil>"
ERRO[0000] init cli app failed                           error="request user account failed: parsing time \"2018-06-26T20:43:50+080:0\": extra text: \":50+0800\""

And if ok, I can submit a pull request.

youyuanwu commented 2 years ago

Yes. PR welcome.

decentral1se commented 1 year ago

Aha, yes, do need this for https://www.kimai.org/documentation/rest-api.html which gives back ISO_8601. I'll take a stab at this.