if (new Date().getTimezoneOffset() === 0) then dayjs.unix(1550251173).startOf('day').unix() returns 1550188800.
if (new Date().getTimezoneOffset() === 300) then dayjs.unix(1550251173).startOf('day').unix() returns 1550206800.
A Unix timestamp is by definition a count of seconds from "00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC)" (http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_16). Thus, the correct result should _always_ be 1550188800.
Because in dayjs.unix(1550251173), dayjs parses and displays in local time. The same in momentjs.
Yes, that should parse into local time. But the final conversion _back_ to a Unix timestamp should generate a number at UTC.
Yes, and that will be of course different. Cause startOf('day') is different.
What do you not understand? The number that results from dayjsInstance.unix() should be the number of seconds from 00:00:00 Thursday, 1 January 1970 _at the UTC timezone_.
I'm closing this until I can figure out where the actual bug lies. I'm not really sure what is happening here.
try UTC plugin
:tada: This issue has been resolved in version 1.8.9 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Most helpful comment
:tada: This issue has been resolved in version 1.8.9 :tada:
The release is available on:
Your semantic-release bot :package::rocket: