Closed Bug 1776191 Opened 2 years ago Closed 6 months ago

Invalid Date when handling Date objects

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1557650

People

(Reporter: piotrsuplat, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0

Steps to reproduce:

Try converting UTC date to a specific timezone. Try the below code in jsfiddle or console:

const date = '2022-06-24 07:00:00';
const event = new Date(date + ' UTC');
console.log(event.toLocaleString('sv-SE', { timeZone: 'Europe/Stockholm' }));

Actual results:

I get "Invalid Date"

Expected results:

I was expecting to see "2022-06-24 09:00:00"
+1 hour for timezone difference
+1 hour for daylight saving time

The above code works perfectly fine in competing browser (Chromium-based, Safari)

Component: Untriaged → JavaScript Engine
Product: Firefox → Core
See Also: → 1599375
Version: Firefox 102 → 69 Branch
Blocks: 1274354
Severity: -- → S3
Priority: -- → P3
Version: 69 Branch → unspecified

This was fixed in bug 1557650.

Status: UNCONFIRMED → RESOLVED
Closed: 6 months ago
Duplicate of bug: 1557650
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.