-
Notifications
You must be signed in to change notification settings - Fork 7
Feature request: a means to make every moment() instance freeze #20
Comments
Apologies on my slow response time while on vacation. I can certainly see value in this idea, but it's a little tricky to make it happen as a plugin. IMO the simplest implementation would extend I'd welcome a PR (with tests) to solve this! |
I'm concerned about static properties of moment. We have code that relies on (say) Likewise, it would be really helpful for the other constructors (e.g. |
@rbalicki2 I've been working recently with Moment's maintainers to get Frozen Moment's features into an official distribution of Moment. I just opened a PR on a draft RFC to make that happen. We're still sorting out how we'll want to package this, but I think my proposed user-facing API should address your concerns -- let me know what you think! I'll be working to implement that RFC after we nail down the remaining details. (I think most of the remaining uncertainty centers around distribution and documentation plans.) |
Rather than |
That would make sense for folks who are using a module system. That namespace would still need to be available on the moment global for the folks who just use unbundled Not sure if/when I'll get the time to do this myself, but I'd certainly welcome a PR with tests. |
I wish there is a global feature to have all moments be immutable by default (ie. call .freeze()), rather than having to remember to use .freeze() function for each moment instance. I think that's worthwhile to do.
The text was updated successfully, but these errors were encountered: