Comment #2 on issue 3413 by [email protected]: new Date('YYYY-MM-DD')
in ISO format parses inconsistently compared to non-ISO formats
http://code.google.com/p/v8/issues/detail?id=3413
The scenario that caught us out was browser-side code which fetches dates
(in JSON) from a server and then renders them in both long and short
format. In our case the dates in question are training-class dates without
any time information. For simplicity we transfer the dates in JSON as short
format strings and only parse/re-format them when we need the long format.
We naively assumed that YYYY-MM-DD strings would be parsed by javascript
the same way as YYYY-M-D strings (without leading zeros).
Who would expect '2014-1-1' to be interpreted as Jan 1st (in the browser's
local time zone) but 2014-10-10 to be treated as Oct 9th when the browser
is west of GMT because the string is being parsed as midnight in the GMT
time zone which then translates to an earlier time when formated.
You could argue that since Safari and Firefox reject the other hyphenated
formats there is less chance of falling into this trap.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.