-
-
Notifications
You must be signed in to change notification settings - Fork 64
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
Replace moment.js with date-fns #973
Comments
When tackling this issue, I'd suggest extending the use of our datetime utility component, seen here: https://github.com/DemocracyLab/CivicTechExchange/blob/master/common/components/utils/datetime.js - as you can see it already has a few functions, but there's more we could put in here. If we can collect all our datetime needs and create reusable functions here and use them in the actual page components, future upgrades or changes to our datetime library will be editing one file in one place, not a dozen files in a dozen places. |
Could I try to solve this issue? I just finished environment set up. |
Absolutely. I'll assign you, feel free to reach out if you're having trouble. There's a lot of components we use moment for, but hopefully it'll make sense how they operate. |
I was wondering if I could try to work on this issue? |
Sure, please do. I checked with Marlon and we think it's open for the taking so it's all yours. |
Is this issue solved? Can I try to work on this issue if not solved? |
PR #1035 solves this issue, pending a couple bugfixes. I believe Kyle's still working on it. |
Short version: load date-fns directly, replace functions which use moment.js with date-fns, remove moment from our package.json, double check that all existing datetime functions still work as expected.
Longer version:
Moment.js is quite large (the two biggest pieces of our bundle, per this analysis of package.json, are moment) and the maintainers themselves suggest moving to an alternative.
We use moment in quite a few places and any replacement must be able to handle all of them. The reason I specify date-fns is it's already a dependency of react-datepicker, which we also use and want to keep at this time. Unless there's a critical reason not to use it, loading one datetime library is better than two.
To sum up, in order for this issue to be resolved,
resources
These may help with the process:
The text was updated successfully, but these errors were encountered: