4 ms·
I think you should have made a non-compatible API. MomentJS's is pretty horrible in my opinion. Why on earth are the Moment objects mutable? Unless there's a go
by mherrmann 9y ago
I think you should have made a non-compatible API. MomentJS's is pretty horrible in my opinion. Why on earth are the Moment objects mutable? Unless there's a good reason (performance?) it's just a pain to have to call weird setters all the time and have to worry about whether you're not accidentally changing an object passed as a function parameter. Python's datetime gets this right in my opinion.
- sarreph 9y agoFor JS usage, I am actually - on the whole - a big fan of moment. However, I agree with you that the mutability of its core object instances is odd. Would also like to know why this design choice was made.
- thefifthsetpin 9y agoThey did make a non-compatible API, and it is immutable. The HN title is just wrong. The actual project was just trying to explain that their API would be familiar to moment js users. They didn't mean to imply stringent API compatibility.