Closed Bug 1868577 Opened 2 years ago Closed 2 years ago

Using new Date of an invalid date results in a new date of 30 nov 1999

Categories

(Core :: JavaScript Engine, defect)

Firefox 120
defect

Tracking

()

RESOLVED DUPLICATE of bug 1866811

People

(Reporter: oostmeijer, Unassigned)

Details

Attachments

(1 file)

Attached image firefox result.png

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Safari/605.1.15

Steps to reproduce:

When using the following code in javascript on a website:

var newDate = new Date('0000-00-00');

See screenshot where I've executed the code above on https://developer.mozilla.org in Firefox and Safari

Actual results:

The result is that newDate will have a date of 30 nov 1999.

Where the result in safari / chrome would give an Invalid Date.

Expected results:

I would expect to have an Invalid date which can be checked with isNaN(newDate)

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Duplicate of bug: 1866811
Resolution: --- → DUPLICATE
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: