Skip to content
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

Apply badMutable plugin locally #2041

Open
marnixhoh opened this issue Aug 25, 2022 · 0 comments
Open

Apply badMutable plugin locally #2041

marnixhoh opened this issue Aug 25, 2022 · 0 comments

Comments

@marnixhoh
Copy link

marnixhoh commented Aug 25, 2022

While this is not technically a bug, I do believe that this is a very important feature for compatibility with moment based libraries.

Current behavior
Applying a plugin (using .extend()) alters the global dayjs constructor. For dayjs to be a replacement for moment in e.g. third party libraries, it is sometimes necessary to use the badMutable plugin.

But when this plugin is applied, whether manually or by some third party code, all dayjs instances in the code base suddenly become mutable, which can lead to unexpected behavior and nasty bugs.

Expected behavior
It should be possible to apply the badMutable plugin locally, to prevent all dayjs instances to suddenly become mutable.

By looking at the source code, I couldn't find a way to make this possible.

Any help or suggestions, would be highly appreciated!!

Thanks :D


There has been a discussion on this before: #655
And this exact issue has let react-day-picker (~4.6K ⭐) to stop using dayjs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant