You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having human-readable times that are not associated with dates is
frequently useful. For example, this lets you say things like:
"tea is at 3:15pm" (localtime)
"the weekly meeting is at 12:00 UTC"
Using the ISO 8061 timeformats 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:
new Date('12:34')
Invalid Date
new Date('T12:34')
Date 1970-01-01T20:34:00.000Z
new Date('T12:34Z')
Date 1970-01-01T12:34:00.000Z
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.
Activity
[-]version/3.0: Add a 'time' type[/-][+]version/3.0: Add a 'time' format[/+]ralfhandl commentedon Feb 3, 2016
+1: OData also has a TimeOfDay primitive type which can now only be represented as a string. We use
partial-timeformat from RFC3339webron commentedon Jul 21, 2016
Tackling PR: #741
webron commentedon Feb 22, 2017
Will be tackled in #845 instead.
webron commentedon Mar 2, 2017
Closing as all issues will be tackled there.