Closed
Bug 1466447
Opened 7 years ago
Closed 7 years ago
new Date return previous day
Categories
(Firefox :: Untriaged, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: im.phitien, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0
Build ID: 20180516032328
Steps to reproduce:
My firefox version: 60.0.1
I create an instance of Date object, see eg
new Date('1970-01-01 00:00:00')
Actual results:
The result is on previous day
Date 1969-12-31T17:00:00.000Z
Expected results:
It should not automatically calculate the date I pass in
Expecting: Date 1970-01-01T00:00:00.000Z
Comment 1•7 years ago
|
||
new Date('1970-01-01 00:00:00')
Assumes you're providing a local datetime. For me, this returns (being in CET)
Date 1969-12-31T23:00:00.000Z
If you want to provide UTC:
new Date(Date.UTC(1970,0,1,0,0,0))
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/UTC
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•