-
Notifications
You must be signed in to change notification settings - Fork 156
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
Migrated to Day.js from Moment.js. #196
Conversation
@JeppeLarsen thanks for PR!
Getting timezone stuff working as before is important. I'll also try to have a look why these tests started to fail. |
Thanks for your reply. I have been trying to debug it and found out that the function "addHours" in date.js is doing strange things when running the test in expression.js from line 1301 to line 1321. It is actually subtracting an hour in my timezone instead of adding one. I cannot seem to figure out if the problems are general issues with day.js or something that could (or should) be solved in this library. I am looking forward to your opinion on this. |
This solves the strange behaviour of the addHour-function. All tests in expression.js now pass.
I solved this. It was a problem with Day.js being immutable. |
It seems that interval.next does not respect the localOffset change |
@JeppeLarsen FYI, there is now also an open PR with I'm really considering moving on with |
https://day.js.org/docs/en/parse/string
Hope that helps. e.g. in #202 the CronDate constructor is matching multiple format patterns to account for a number of formats that JS Date supports (though inconsistently in browsers aka the deprecation warning in moment says
Main things I have against Day.Js though (although with 1 or less locales it can be smaller) are:
There's no answer that will make everyone happy though, so I'd understand |
I've tried to do the work needed for the formats for this branch, but with moment and luxon supporting RFC2822 https://github.com/moment/luxon/blob/master/src/impl/regexParser.js, I think it'd be a stretch to support that format with dayjs. |
"testParser": "tap ./test/parser.js", | ||
"testLy": "tap ./test/leap_year.js", | ||
"testIofi": "tap ./test/increment_on_first_iteration.js", | ||
"test31": "tap ./test/31_of_month.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can do npx tap ./test/expression.js
rather than list every test as a script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry for bloating the package.json with this. These lines were not supposed to be pushed.
You should move on with luxon for now. We can switch to Day.js, when/if it becomes mature enough to include the timezone-support. |
Thank you. I will look into the formatting-thing. |
Closing this for now. |
(This should resolve issue #195 )
I have tried to migrate from Moment.js to Day.js, because Moment.js is no longer being supported and because Day.js has a lot smaller bundle size. See this for comparison: Day.js bundlephobia vs Moment.js bundlephobia.
PLEASE NOTE: Not all tests pass - probably because of some difference between Day.js and Moment.js in the way time zones are being handled.
The tests that do not pass are:
Perhaps someone can look into these bugs.