-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
version/3.0: Add a 'time' format #358
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Spun off from #355 to avoid PRs which don't attract comments ;).
Having human-readable times that are not associated with dates is
frequently useful. For example, this lets you say things like:
Using the ISO 8061 time formats should make it easy for both
people and software to interact with the values.
Since Swagger-specified APIs are often consumed and produced from
JavaScript, and since JavaScript has limited time-handling
capabilities, I thought I'd dig a bit deeper in that direction.
Support for date-less ISO 8601 times in native JavaScript is unclear,
but Firefox 31.5 in seems to support times with a 'T' prefix:
which, in conjunction with Date.prototype.toTimeString() and other
time-specific maniplations is probably sufficient for most purposes.
Chromium 41.0, on the other hand, gave 'Invalid Date' warnings for
each of those cases, so JavaScript consumers may want to pad their
times with dummy date information. Moment.js also requires a date
part and doesn't support stand-alone times.
On the other hand, there are time-only pickers in JavaScript.
Python also has a time-only format as does Java. Go just
has a date-time type, but it can parse time-only strings.
The text was updated successfully, but these errors were encountered: