[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnuzilla] JavaScript bug in Date class, incorrect date/time returne
From: |
Jelle Geerts |
Subject: |
[Bug-gnuzilla] JavaScript bug in Date class, incorrect date/time returned |
Date: |
Fri, 7 Jun 2019 16:14:15 +0200 |
var s1 = new Date().toString();
var s2 = new Date().toLocaleString();
var s3 = new Date().toLocaleString('nl', {'timeZone': 'Europe/Amsterdam'});
The resulting strings were:
s1 === 'Fri Jun 07 2019 13:58:32 GMT+0000 (UTC)'
s2 === '6/7/2019, 1:58:32 PM'
s3 === '7-6-2019 15:58:32'
s1 is not as expected (bug).
s2 is not as expected (bug).
s3 is as expected.
Expected output (taken from Firefox; Chrome has the exact same output):
s1 === 'Fri Jun 07 2019 15:58:32 GMT+0200 (Central European Summer Time)'
s2 === '6/7/2019, 3:58:32 PM'
s3 === '7-6-2019 15:58:32'
Tested in a virtual machine on a clean install of Ubuntu 18.04 LTS.
System locale: en-US
System time zone: Europe/Amsterdam (which is UTC+02:00 at this moment)
Other browsers, such as Firefox, running on the same system as IceCat,
do return the expected output (no bug).
Also, websites seem to rely on (new Date().toString()) returning a
localized date/time,
as shown in the expected output.
Firefox and Chrome do this.
$ icecat --version
GNU IceCat 60.7.0
- [Bug-gnuzilla] JavaScript bug in Date class, incorrect date/time returned,
Jelle Geerts <=