-
Notifications
You must be signed in to change notification settings - Fork 408
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
Use dayjs or date-fns instead of Moment.js #449
Comments
I have not actually implemented this myself but it should be done already. I designed this so you can use any library other than moment. Just write your own implementations of Given that I haven't actually done this, you may run into some issues but they should be easy to fix. I would happily accept your merge request with some additional modules using other date libraries so that others can benefit from your work. Since you mention size and not performance, I'm curious about your use case. How does a ~50k savings in gzip size impact your application? |
@konuch Did you try implementing another library? I have the same "problem". For me the size matters, because the project is deployed on the small ESP8266 storage. |
Sorry for late answer, but unfortunately I haven't managed to solve it. I tried to separate momentJS from core logic by moving momentJS references to its own module and adapter files and created similar files for dayjs. I had hoped that if I import only these dayJS modules into my app, momentJS library wont be part of the final bundle, but sadly it was. As long as you export files which use momentjs lib in 'index.ts' file, momentjs becomes a required dependency of your app. Sadly, moment.js can not be tree shaken during the build process. |
Hey @konuch thanks for the update. Do you have a fork of this project with your changes that you can share? I'm no expert on tree shaking but I'm happy to have a look and see if I get it working. |
Waiting for some code from @konuch - will close if no response in the next week or so. |
I've looked into this and know how to get this component working without Thumbs up the original post of you would like this feature. |
Please describe the feature you would like to request.
Remove the moment.js library requirement. Allow usage of different datetime library, if necessary.
What is the use-case or motivation for this proposal?
Moment.js is a great library, but it has some problems, one of them being too huge. There are other libraries, like dayjs or date-fns that address moment.js issues and preserve pretty much the same API. See https://github.com/you-dont-need/You-Dont-Need-Momentjs
Is there anything else I should know?
The text was updated successfully, but these errors were encountered: