archives

« Bugzilla Issues Index

#112 — 15.9.1.15 time zone handling contradicts ISO 8601


I realize that ECMAScript's date time format is "based upon a simplification of" ISO 8601, but edition 5.1 actually contradicts it. Page 16, section 4.2.2.2 of ISO 8601:2004(E) defines "Complete representations" of "local time" as hhmmss and hh:mm:ss, i.e. without any time zone offset.

A comparison of the two specifications follows. Please note the examples given by ISO 8601:2004(E).

ECMA-262 edition 5.1 (p. 179):
The value of an of absent time zone offset is "Z".

ISO 8601:2004(E) (p.19):
4.3.3 Representations other than complete
For reduced accuracy, decimal or expanded representations of date and time of day, any of the representations in 4.1.2 (calendar dates), 4.1.3 (ordinal dates) or 4.1.4 (week dates) followed immediately by the time designator [T] may be combined with any of the representations in 4.2.2.2 through 4.2.2.4 (local time), 4.2.4 (UTC of day) or 4.2.5.2 (local time and the difference from UTC)...

The following are examples of reduced representations of combinations of date and time of day
representations:

a) Calendar date and local time
Basic format: YYYYMMDDThhmm Example: 19850412T1015
Extended format: YYYY-MM-DDThh:mm Example: 1985-04-12T10:15

b) Ordinal date and UTC of day
Basic format: YYYYDDDThhmmZ Example: 1985102T1015Z
Extended format: YYYY-DDDThh:mmZ Example: 1985-102T10:15Z


Yes, this was changed in ES5.1 but not correctly. ES5 didn't explicitly say what to do if the time zone was missing but implementations seem to have correctly treated those as local times. That what 5.1 should have also said.

This need to go into the ES5.1 errata


see modified text in ES6 draft


set IN_PROGRESS to indicated this should go into ES5.1 Errata.


Seems, similar issue with
15.9.1.15 “date-time” forms
ISO 8601 says:
"the date component shall not be represented with reduced accuracy"
(for date-time forms)

but ES 5.1 says:

YYYY
YYYY-MM
YYYY-MM-DD

It also includes “date-time” forms that consist of one of the above date-only forms immediately followed by “T” and one of the following time forms with an optional time zone offset appended:

THH:mm
THH:mm:ss
THH:mm:ss.sss

Although, "YYYYTHH:mm" is not very usefull and not allowed by ISO 8601


Bulk resolving ES5.1 errata issues as a sampling suggests these are all fixed. If this is in error, please open a new issue on GitHub.