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

[v1] Quasar LocalStorage do not restore Date object after get #4338

Closed
DmitrijOkeanij opened this issue Jun 8, 2019 · 5 comments
Closed

Comments

@DmitrijOkeanij
Copy link
Contributor

I have object

import {LocalStorage} from 'quasar';

const obj = {
   prop1: "hi",
   prop2: new Date()
}

LocalStorage.set("key",obg);
const newObj = LocalStorage.getItem("key");

If I store it with quasar LocalStorage, and after it get from it.
Object prop2 Date field become string.
But have to be Date.

@metalsadman
Copy link
Member

metalsadman commented Jun 8, 2019

i think coz you stored it inside an object, try setting it on a different key as is, otherwise not hard to parse it back to a date object imo.

@DmitrijOkeanij
Copy link
Contributor Author

This is not solution, because if it is all automated it is simple. But if I have complex object with many properies some of them are Dates, it will be painfull and not a solution.

@metalsadman
Copy link
Member

while you are right, the api only knows the type by each key which they are assigned, in your case is an object, it doesn't traverse deep inside it to encode/decode the inner properties in their respective type.

@DmitrijOkeanij
Copy link
Contributor Author

Ok. It is clear.
So I propose feature to investigate object graph deep and to retreave the same object as placed in localStorage.

pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 19, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 19, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 20, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 21, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 21, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 22, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 23, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 24, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 25, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 25, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 25, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 25, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 26, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 26, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 26, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 27, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 27, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 27, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jun 27, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 8, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 8, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 8, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 8, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 9, 2019
pdanpdan added a commit to pdanpdan/quasar that referenced this issue Jul 9, 2019
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

3 participants