-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dayjs.utc() dropped timezone offset support #1239
Comments
The above three should have the same result. Cause it represents the same time '2020-12-01T09:00:00+0900' |
There was my mistake in the code snippet. I'll explain again. What I said is your invariant is not established. codesandbox // Windows 10 + Chrome 86.0.4240.198
dayjs.utc('2020-12-01T09:00:00+0900').toDate().getTime(): 1606813200090
dayjs ('2020-12-01T09:00:00+0900').toDate().getTime(): 1606780800090
new Date('2020-12-01T09:00:00+0900') .getTime(): 1606780800000 |
This might be a bug in UTC plugin. |
Hi. I researched about this issue. Lines 28 to 29 in 17221ec
|
@t-mangoe is correct. To be sure the last digit token in REGEX_PARSE only matches for milliseconds, the period must be escaped. Otherwise, it acts as a wildcard. To offer some more examples, all of these are the same date/time using different ISO 8601 time zone formats: I'm sorry I don't know how to contribute the fix, but the code should read: Thank you for the library. It's very useful! |
I added a pull request with the change: #1295 |
includes two tests that would have matched before fix iamkun#1239 but no longer match
fixed in #1295 |
# [1.10.0](v1.9.8...v1.10.0) (2021-01-03) ### Bug Fixes * add ordinal to localeData plugin ([#1266](#1266)) ([fd229fa](fd229fa)) * add preParsePostFormat plugin & update Arabic [ar] locale ([#1255](#1255)) ([f2e4790](f2e4790)) * add type support for plural forms of units ([#1289](#1289)) ([de49bb1](de49bb1)) * escape last period to match only milliseconds ([#1239](#1239)) ([#1295](#1295)) ([64037e6](64037e6)) ### Features * add ES6 Module Support, package.json module point to "esm/index.js" ([#1298](#1298)) ([f63375d](f63375d)), closes [#598](#598) [#313](#313)
# [1.10.0](iamkun/dayjs@v1.9.8...v1.10.0) (2021-01-03) ### Bug Fixes * add ordinal to localeData plugin ([#1266](iamkun/dayjs#1266)) ([fd229fa](iamkun/dayjs@fd229fa)) * add preParsePostFormat plugin & update Arabic [ar] locale ([#1255](iamkun/dayjs#1255)) ([f2e4790](iamkun/dayjs@f2e4790)) * add type support for plural forms of units ([#1289](iamkun/dayjs#1289)) ([de49bb1](iamkun/dayjs@de49bb1)) * escape last period to match only milliseconds ([#1239](iamkun/dayjs#1239)) ([#1295](iamkun/dayjs#1295)) ([64037e6](iamkun/dayjs@64037e6)) ### Features * add ES6 Module Support, package.json module point to "esm/index.js" ([#1298](iamkun/dayjs#1298)) ([f63375d](iamkun/dayjs@f63375d)), closes [#598](iamkun/dayjs#598) [#313](iamkun/dayjs#313)
# [1.10.0](iamkun/dayjs@v1.9.8...v1.10.0) (2021-01-03) ### Bug Fixes * add ordinal to localeData plugin ([#1266](iamkun/dayjs#1266)) ([fd229fa](iamkun/dayjs@fd229fa)) * add preParsePostFormat plugin & update Arabic [ar] locale ([#1255](iamkun/dayjs#1255)) ([f2e4790](iamkun/dayjs@f2e4790)) * add type support for plural forms of units ([#1289](iamkun/dayjs#1289)) ([de49bb1](iamkun/dayjs@de49bb1)) * escape last period to match only milliseconds ([#1239](iamkun/dayjs#1239)) ([#1295](iamkun/dayjs#1295)) ([64037e6](iamkun/dayjs@64037e6)) ### Features * add ES6 Module Support, package.json module point to "esm/index.js" ([#1298](iamkun/dayjs#1298)) ([f63375d](iamkun/dayjs@f63375d)), closes [#598](iamkun/dayjs#598) [#313](iamkun/dayjs#313)
Describe the bug
dayjs.utc('2020-12-01T09:00:00+0900').toDate().getTime() === new Date('2020-12-01T09:00:00+0900').getTime()
Expected behavior
The above evaluates to true. It's the behaviour of dayjs 1.8.33.
Actual behaviour
Information
The text was updated successfully, but these errors were encountered: