go-openapi / strfmt

openapi toolkit common string formats
Apache License 2.0
102 stars 62 forks source link

handle time offset without colon #66

Closed ghost closed 4 years ago

ghost commented 4 years ago

Was using go-swagger and was having issues with a server I don't control sending back a time string like 2020-07-16T20:10:54.570+0000

I was getting an error from parsing time "2020-07-16T19:13:38.908+0000": extra text: :38.908+0000

This seems to fix that. Not super familiar with this codebase, just took a jab and added some tests where it felt correct. Let me know if there's any adjustments you'd like to see or concerns.

archer-v commented 4 years ago

A lot of services written in Java represent dates in ISO-8601 format, where a time zone can be represented in format ....mm:ss.ssss+0000. Data-model which is built by go-swagger can't work with these dates without crutches. Also, Facebook use dates in this format too. It's an actual issue and this commit should fix it. It contains just a few lines with obvious changes but somehow is still on a review stage

ghost commented 4 years ago

Not sure, just running a fork myself. Maintainer acts like it's up to us to not use services that display a different type of timezone with no way of proving an alternative format. https://github.com/go-openapi/strfmt/issues/65#issuecomment-623580267