rtfeldman / seamless-immutable

Immutable data structures for JavaScript which are backwards-compatible with normal JS Arrays and Objects.
BSD 3-Clause "New" or "Revised" License
5.36k stars 194 forks source link

Moment.js issues #218

Open anchpop opened 7 years ago

anchpop commented 7 years ago

Hi, I'm using moment.js

When putting the moment object (returned by moment()) in a Immutable datastructure, it gets broken and essential features like .format() mysteriously quit working. Confusingly, the function moment.isMoment() still returns true, despite not being able to use it like a moment object at all.

I believe this is related to #25 . Any thoughts on getting moment objects classified like react objects and dates, so they won't have their prototypes stripped (which is what I believe is happening)?

pedrogarciyalopez commented 7 years ago

same problem

rkkautsar commented 6 years ago

🆙

EDIT: Solved by serializing and deserializing (with format and parse)

andykais commented 5 years ago

as an alternative to momentjs, there is luxon, which is an immutable, date time library that is somewhat of a subset of momentjs. It is still part of the momentjs family of libraries however

jkeam commented 5 years ago

Similar to @rkkautsar my work around involved NOT storing moment objects but instead storing strings. It's a bit of a pain to convert them back and forth using format and parse and would love to see this implemented.