ember-localstorage-adapter
ember-localstorage-adapter copied to clipboard
Cannot store Date object
If I store JS Date object, local storage just store '{ }'. Is there any solution to store Date object?
+1
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 :)
Doesn't DS.attr('date')
take care of this for us?
@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)
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 :)