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

[bugfix] toJSON: Fix isValid so that toJSON works after a moment is frozen #3383

Closed
wants to merge 1 commit into
base: develop
from

Conversation

Projects
None yet
4 participants
@ben-ng

ben-ng commented Aug 19, 2016

A small fix so that moments can be serialized with JSON.stringify after Object.freeze has been used on it.

@mj1856 mj1856 added the Bug-fix label Aug 22, 2016

@maggiepint

This comment has been minimized.

Member

maggiepint commented Aug 25, 2016

We can't use this in Moment v2 because it technically supports IE 8. We have some options here:

  • Bump this to v3, but v3 will be immutable anyways, so maybe it doesn't matter
  • just skip it
  • Shim the object.isfrozen call to return false if the function isn't available

Preferences?

@ichernev

This comment has been minimized.

Contributor

ichernev commented Aug 28, 2016

@maggiepint I think this particular change can be slightly rewritten to support both IE8 an above. If there is such thing as frozen -- check if it is, otherwise assume it isn't (because it can't be).

@ben-ng just check if isFrozen exists first, and it will do the trick.

@ichernev ichernev added this to the 2.15.0 milestone Aug 28, 2016

@mj1856 mj1856 added Needs Revision and removed todo labels Aug 29, 2016

@mj1856

This comment has been minimized.

Member

mj1856 commented Aug 29, 2016

@ichernev - I'm using "Needs Revision" rather than "todo" as it's more descriptive.

@ben-ng please add the check as @ichernev suggested. Thanks.

@ichernev

This comment has been minimized.

Contributor

ichernev commented Sep 3, 2016

Merged in de9799b

@ichernev ichernev changed the title from Fix isValid so that toJSON works after a moment is frozen to [bugfix] toJSON: Fix isValid so that toJSON works after a moment is frozen Sep 3, 2016

@ichernev ichernev closed this Sep 3, 2016

ichernev added a commit that referenced this pull request Sep 3, 2016

Merge pull request #3383 from ben-ng:develop
[bugfix] toJSON: Fix isValid so that toJSON works after a moment is frozen
@ben-ng

This comment has been minimized.

ben-ng commented Sep 6, 2016

Thanks for making the fix and merging this while I was on vacation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment