Skip to content
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

Implemented toJSON function on Duration #1825

Closed
wants to merge 2 commits into from
Closed

Implemented toJSON function on Duration #1825

wants to merge 2 commits into from

Conversation

dyro
Copy link

@dyro dyro commented Aug 3, 2014

Implemented toJSON function on Duration so JSON.stringify returns the ISO string representation of the duration

This is a fix for issue #1714

JSON.stringify(moment.duration(1024, 'd'));

Old Result:

'{"_milliseconds":0,"_days":1024,"_months":0,"_data":{"milliseconds":0,"seconds":0,"minutes":0,"hours":0,"days":4,"months":10,"years":2}}'

New Result:

'"P2Y10M4D"'

… ISO string representation of the duration
@ichernev
Copy link
Contributor

ichernev commented Aug 5, 2014

Looks good. We'll in the next minor.

@ichernev ichernev added this to the 2.9 milestone Aug 5, 2014
@ichernev
Copy link
Contributor

Merged in f9f7b2e

@ichernev ichernev closed this Dec 24, 2014
ichernev added a commit that referenced this pull request Dec 28, 2014
Implemented toJSON function on Duration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants