-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Optional moment.js Part 2 #1052
Optional moment.js Part 2 #1052
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1052 +/- ##
=========================================
+ Coverage 83.1% 83.51% +0.4%
=========================================
Files 13 13
Lines 817 837 +20
Branches 141 141
=========================================
+ Hits 679 699 +20
Misses 33 33
Partials 105 105
Continue to review full report at Codecov.
|
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.
Looks good to me. @martijnrusschen Care to take a look?
@@ -24,105 +27,105 @@ describe('Calendar', function () { | |||
} | |||
|
|||
it('should start with the current date in view if no date range', function () { | |||
const now = moment() | |||
const now = utils.newDate() |
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.
It might be a bit cleaner to use separate functions to parse a date and to get the current date. We can leave that for later though, since moment()
did serve both purposes too.
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.
Yeah, had exactly the same thought :)
Seems solid. Lots of changes, so lets hope we don't break anything. How should we move forward with this. First merge part 1? |
Since this part contains also part 1, we can close the other and merge only part 2. |
@martijnrusschen Sounds good, that way it's clear the changes to the code are independent from the changes to the unit tests. |
@prayerslayer Part 1 got merged. Can you rebase your PR so that we can merge part 2 as well? |
9e86cd0
to
f046042
Compare
Done. |
WIP of Part 3 is here: https://github.com/prayerslayer/react-datepicker/tree/feature/optional-moment-part3
|
Sounds fine. As long as we discuss this as a breaking change
Not sure how what's desired here. Any suggestions? |
Hi, thanks for taking the time. I already opened a PR to discuss details about this. #1059 It has a proof of concept too.
Yeah. My proposal is that all timezone related functions would be no-ops when using date-fns, until the library can work with TZs (if ever). That way
At first I tried to extract the TZ logic from moment into something separate, but quickly realized I'm building moment on top of date-fns, as you have to consider TZ information for all regular operations like adding hours etc. That's an option too, but it can be done later imo. |
Basically it's #1046 minus
moment
in tests.The idea is that after this PR I can:
date_utils
without momentreact-datepicker
to work with whatever while having a good idea if I broke something