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

fix packing of date objects in hashmaps #2

Closed
wants to merge 1 commit into from

Conversation

dstokes
Copy link

@dstokes dstokes commented Jan 20, 2014

packing of objects with new Date() objects as values results in the value being converted to {}. this change converts date objects to timestamp strings

@dogada
Copy link
Owner

dogada commented Feb 7, 2014

Drew, thanks for your patch, but decoder should restore exactly same objects that encoder stored. We can't store Date and restore String.

There is no Date data type in JSON format and people usually converts Dates to a string representation before calling JSON.stingify or use a JSON extension like EJSON for automatic Date conversion.

You can also look for other popular approaches on SO: http://stackoverflow.com/questions/10286204/the-right-json-date-format

@dogada dogada closed this Feb 7, 2014
@dstokes
Copy link
Author

dstokes commented Feb 7, 2014

maybe something added to the docs then? i can't be the only person who's run into this gotcha ;)

dogada added a commit that referenced this pull request Feb 9, 2014
@dogada
Copy link
Owner

dogada commented Feb 9, 2014

Good idea. Updated docs and added some tests in 8d8e4c7

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.

2 participants