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

Cannot store Date object #92

Open
pewh opened this issue Nov 4, 2014 · 5 comments
Open

Cannot store Date object #92

pewh opened this issue Nov 4, 2014 · 5 comments

Comments

@pewh
Copy link

pewh commented Nov 4, 2014

If I store JS Date object, local storage just store '{ }'. Is there any solution to store Date object?

@James1x0
Copy link

James1x0 commented Dec 1, 2014

+1

@kurko
Copy link
Collaborator

kurko commented Jan 24, 2015

LS is, after all, just a string storage, so for date we'd have to serialize into string (e.g using ISO8601) and deserialize back when retrieving. A PR would be welcome :)

@locks
Copy link
Owner

locks commented Oct 5, 2015

Doesn't DS.attr('date') take care of this for us?

@James1x0
Copy link

James1x0 commented Oct 5, 2015

@locks afaik, it's lost once you persist it. There's no transform for the date type. It would be easy tho, date.toISOString() / new Date(isoString)

@kurko
Copy link
Collaborator

kurko commented Nov 13, 2015

Yes. The PR should be simple, though. Anyway who's needing this, please start a PR and we'll guide you through getting it merged :)

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

No branches or pull requests

4 participants