3 ms·
> Moment.js with the same modern API Moment.js objects are mutable [0], and this library's objects are ... immutable. [0] https://momentjs.com/guides/#/lib-co
by taspeotis 4y ago
> Moment.js with the same modern API
Moment.js objects are mutable [0], and this library's objects are ... immutable.
[0] https://momentjs.com/guides/#/lib-concepts/mutability/ https://momentjs.com/guides/#/lib-concepts/mutability/
- moogly 4y agoThe mutability in Moment.js is not really a feature though, just a massive inconvenience/source of bugs (unless you use `.clone()` all over the place). But yeah, very important difference.
- miohtama 4y agoMutability cannot be enabled thru plugin: https://day.js.org/docs/en/plugin/bad-mutable https://day.js.org/docs/en/plugin/bad-mutable However it is discouraged as mutable dates often lead to less maintainable, harder to debug, code.
- brundolf 4y agoIt's not quite exactly the same API - you'll need to do some testing afterward - but if you're using Moment idiomatically, nearly everything should just-work