Comment #6 on issue 491802 by
ns...@google.com: Date.toLocaleString:
It looks like timeZoneName: ('short' or 'long') causes hour12 to be ignored
in the reverse case, too.
The result is incorrect with hours, minutes, and seconds displayed -
removing seconds results in the value of hour12 being handled correctly.
> (new Date(0)).toLocaleString('en-GB', {timeZone: 'America/Los_Angeles',
> timeZoneName: 'short', hour: 'numeric'})
< "16 PST"
(The 24-hour clock is default for en-GB.)
> (new Date(0)).toLocaleString('en-GB', {timeZone: 'America/Los_Angeles',
> timeZoneName: 'short', hour: 'numeric', hour12: true})
< "4 pm PST"
> (new Date(0)).toLocaleString('en-GB', {timeZone: 'America/Los_Angeles',
> timeZoneName: 'short', hour: 'numeric', hour12: true, minute: 'numeric'})
< "4:00 pm PST"
(These results are expected.)
> (new Date(0)).toLocaleString('en-GB', {timeZone: 'America/Los_Angeles',
> timeZoneName: 'short', hour: 'numeric', hour12: true, minute: 'numeric',
> second: 'numeric'})
< "16:00:00 PST"
(The value of hour12 is ignored - the results are similar if you
use 'en-US' and hour12: false.)