Closed Bug 1600902 Opened 5 years ago Closed 4 years ago

Date.getFullYear is returning Year with dash sign

Categories

(Core :: JavaScript: Standard Library, defect, P2)

70 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1439800

People

(Reporter: ansarimujiburrehman, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: parity-chrome)

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

Steps to reproduce:

I have just wrote
new Date("31-Mar-2011").getFullYear();
on console and the result I got is "-2011".

Actual results:

We are getting year as "-2011".
With extra dash "-" sign

Expected results:

Ideally it should return only "2011" without that extra dash sign.

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0
20191203094830

Works in Vivaldi 2.9.

Status: UNCONFIRMED → NEW
Has STR: --- → yes
Component: Untriaged → JavaScript Engine
Ever confirmed: true
Keywords: parity-chrome
OS: Unspecified → All
Product: Firefox → Core
Hardware: Unspecified → All
Blocks: 1274354
Component: JavaScript Engine → JavaScript: Standard Library

I think Vivaldi is V8 based browser, but FF is Spider-Monkey ... both have different JS runtime.

The priority flag is not set for this bug.
:jorendorff, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jorendorff)

See blocking bug 1274354. The symptom here is particularly egregious.

I would like to see this fixed but don't have time to work on it myself.

Flags: needinfo?(jorendorff)
Priority: -- → P2

Just to add as per my bug https://bugzilla.mozilla.org/show_bug.cgi?id=1609401

This isn't a dash issue, it actually seems to be creating a negative datetime, if you export the date as ticks it is creating a negative tick value.

var d = new Date("20-Jan-2020");
d.getTime();

Result = -125910633525000

Severity: normal → S3
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1439800
No longer duplicate of bug: 1515318
No longer duplicate of this bug: 1609401
You need to log in before you can comment on or make changes to this bug.