Reputation: 4585
From description of this function at https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
The toISOString() method returns a string in simplified extended ISO format (ISO 8601), which is always 24 characters long: YYYY-MM-DDTHH:mm:ss.sssZ. The timezone is always zero UTC offset, as denoted by the suffix "Z".
It should return 24 characters long all the time. Check the following example:
var d = new Date('08AUG20144');
d.toISOString();
Returns +020144-08-08T04:00:00.000Z
which is 27 characters long. Any reason?
Upvotes: 0
Views: 1786
Reputation: 664385
The ECMAScript specification says about Extended Years:
ECMAScript requires the ability to specify 6 digit years (extended years); approximately 285,426 years, either forward or backward, from 01 January, 1970 UTC. To represent years before 0 or after 9999, ISO 8601 permits the expansion of the year representation, but only by prior agreement between the sender and the receiver. In the simplified ECMAScript format such an expanded year representation shall have 2 extra year digits and is always prefixed with a + or – sign. The year 0 is considered positive and hence prefixed with a + sign.
Upvotes: 4