Closed Bug 1375236 Opened 7 years ago Closed 7 years ago

Javascript: Date.toLocaleDateString() ignores "UTC" param, always local date?

Categories

(Core :: JavaScript: Internationalization API, defect)

54 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: fred.steinberg, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

Steps to reproduce:

    <script>
      var d_utc = new Date( Date.UTC("2017","5","21"));
      var d_string = d_utc.toLocaleDateString( 'en-US', { timeZone: 'UTC',
                                                     weekday:  'long',
                                                     day:      'numeric',
                                                     month:    'long',
                                                     year:     'numeric' });
      alert( d_utc + ' - ' + d_string );
    </script>


Actual results:

Tue Jun 20 2017 20:00:00 GMT-0400 (EDT) - 06/20/2017


Expected results:

Tue Jun 20 2017 20:00:00 GMT-0400 (EDT) - Wednesday, June 21, 2017

Note should display 21st, not 20th. UTC is specified. Desktop Firefox works as expected.

Note also format is incorrect (06/21/2017 should be Wednesday, June 21 2017), but that's another kettle of fish.
maybe something related to bug 1344625.
Component: General → JavaScript: Internationalization API
Product: Firefox for Android → Core
Yes, mobile Firefox doesn't yet support any Intl (ECMA-402) methods, which includes the locale and options parameters for Date.prototype.toLocaleDateString.
Depends on: 1344625
This is now fixed on beta since bug 1344625 landed.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.