Closed Bug 1073307 Opened 5 years ago Closed 3 years ago

Date.prototype.toLocaleTimeString doesn't support IANA timezone names

Categories

(Core :: JavaScript: Internationalization API, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: nicolas, Assigned: anba)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.6 Safari/537.36

Steps to reproduce:

Call `Date().toLocaleTimeString('fr', { timeZone: 'Europe/Paris' })` in JavaScript.


Actual results:

The timezone that was used is GMT.


Expected results:

The time should be converted to the specified timezone.
This was sent from Chromium since I'm currently rebuilding Firefox ;)

While the spec (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString) states handling IANA timezone names isn't mandatory, it is extremely convenient and JavaScript applications might rely on it.
The rationale is similar to https://bugzilla.mozilla.org/show_bug.cgi?id=837961
Component: JavaScript Engine → JavaScript: Internationalization API
Yeah, it's something we should do.  Not certain when, but it'll happen eventually.

(I kinda feel like this is a dup, but if André didn't tag it so I'm not going to pretend second-guess him.  :-) )
Status: UNCONFIRMED → NEW
Ever confirmed: true
Depends on: 837961
Attached patch intl-tolocale-tz.patch (obsolete) — Splinter Review
No additional code changes, except for the ones in bug 837961, are required to support the timeZone property for Date.prototype.toLocale{Date,Time}String(). We only need to test everything works as expected.
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Attachment #8786843 - Flags: review?(jwalden+bmo)
Attachment #8786843 - Flags: review?(jwalden+bmo) → review+
Attached patch Bug1073307.patchSplinter Review
Updated patch to include comments requested for similar tests in bug 837961. Carrying r+ from Waldo.
Attachment #8786843 - Attachment is obsolete: true
Attachment #8806364 - Flags: review+
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/551718400ad4
Add tests for timeZone support in Date.prototype.toLocaleString. r=Waldo
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/551718400ad4
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.