-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
[Feedback Needed] Upgrade to use date-fns-v2 #150
[Feedback Needed] Upgrade to use date-fns-v2 #150
Conversation
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/arthurdenner/react-semantic-ui-datepickers/iouutrftis |
Date-fns' Many instances of the Can some if not all of these be safely changed to Date without introducing breaking changes? |
5ce52f1
to
c293eaf
Compare
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.
Thank you very much, @pivotal-james-zcheng!
This is a long-wanted change and I didn't know this upgrade package, very handy!
I've pointed some minor changes as I just ran through the code here on GitHub.
I kindly ask you to give me some days to try and test these changes. Our test coverage is not so good at the moment - but it's increasing. Maybe we can try to add more tests before moving with these changes? I'll try to do it, but feel free to do it as well if you want to - just let me know.
I'm about to release another project too and that's another reason to hold this PR for some days as I'm completely focused on it.
Thank you once again for your help.
I'll come back with more info as soon as I can!
@@ -34,9 +33,10 @@ | |||
"license": "MIT", | |||
"dependencies": { | |||
"@babel/runtime": "7.7.7", | |||
"@date-fns/upgrade": "1.0.1", |
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 don't think this package needs to be installed in the project as we can run it with npx
. But if you wish to keep it for convenience, can you move it to be a devDependency, please?
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.
The codemode tool (date-fns-upgrade-codemod) can be run using npx
which does not require us to add additional dependencies. Unfortunately, transitional methods provided by support package date-fnd-upgrad, such as legacyParse
and convertToken
, require us to add the package as a main dependency.
I have worked to remove the usages for legacyParse
in this PR, but I am leaning towards keeping convertToken
.
In v2.0, date-fns introduced breaking changes to which format strings they accept. Some changes include accepting yyyy
instead of YYYY
, and dd
instead of DD
. In addition, characters are now escaped using single quote symbols ('
) instead of square brackets. See corresponding section in the changelog
I have not been able to find a way to remove convertToken
and still pass the tests..
Considering the new format string validations are more strict than before, and the format is different, I am inclined to keep convertToken
to avoid introducing breaking changes for anyone using this library.
I've decided to go ahead with removing I am not familiar with the range prop |
@arthurdenner Please review this PR and let me know if any of the changes are breaking functionalities. The tests seem to pass and the widget works well in the storybook, but I am not sure if I missed anything not covered by tests. Thanks! |
021984f
to
5cd4afc
Compare
- everything compiles and tests pass - using legacyParse Todo - remove forked version of date fns - remote legacyParse if possible
- Split parseOnBlur into single and range methods to fix "Property 'every' does not exist on type 'Date | Date[]'" error
5cd4afc
to
19dfb8d
Compare
Codecov Report
@@ Coverage Diff @@
## develop #150 +/- ##
===========================================
+ Coverage 88.13% 88.19% +0.05%
===========================================
Files 14 14
Lines 430 432 +2
Branches 79 78 -1
===========================================
+ Hits 379 381 +2
Misses 49 49
Partials 2 2
Continue to review full report at Codecov.
|
@pivotal-james-zcheng, sorry for the wait to update this PR, I was busy with another project. I've added more tests on #170 and rebased this PR to get the latest changes and solve conflicts. Now I'm more confident to merge this change. 😃 Thank you very much once again! 🎉 |
🎉 This PR is included in version 2.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What kind of change does this PR introduce?
This PR upgrades the date-fns used in the library to V2.9.0. This PR also removes the forked/copied version of date-fns V2.0.0-beta3
Resolves #48
Note
Date-fns-upgrade tool was used to upgrade.
This PR currently compiles and all tests pass. Since the automated tool was used,
there are many usages ofthere is one usage oflegacyParse
andconvertToken
in the codebaseconvertToken
in the codebase.This PR is not ready to be merged yet. The PR is created for the changes to go through CI and be available for feedback sooner.
Checklist:
- [ ] DocumentationNA- [ ] RemoveNot removing to avoid introducing breaking changesconvertToken
legacyParse