You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior
Creating UTC Dayjs objects should work the same way as creating regular dayjs objects, which means passing a dayjs object as a parameter should work just fine. Instead, creating a dayjs object from a dayjs object works only if you do dayjs() but not dayjs.utc().
Information
Day.js Version 1.9.6
OS: Windows 10
Browser Edge 87
Time zone: CET
The text was updated successfully, but these errors were encountered:
Describe the bug
Do this:
let plainDate = '2018-02-20T23:59:59.000Z';
let obj = dayjs(plainDate);
console.log(1, dayjs.utc(plainDate).toISOString());
console.log(1, dayjs.utc(obj).toISOString());
console.log(2, dayjs(plainDate).utc().toISOString());
console.log(2, dayjs(obj).utc().toISOString());
The second console.log will print an incorrect date (today at 00:00:00) instead of the original date passed. Doing this however:
console.log(1, dayjs.utc(obj.toDate()).toISOString());
Seems to work just fine.
Expected behavior
Creating UTC Dayjs objects should work the same way as creating regular dayjs objects, which means passing a dayjs object as a parameter should work just fine. Instead, creating a dayjs object from a dayjs object works only if you do
dayjs()
but notdayjs.utc()
.Information
The text was updated successfully, but these errors were encountered: