PillowPillow / ng2-webstorage

Localstorage and sessionstorage manager - Angular service
MIT License
428 stars 92 forks source link

Don't convert date from string #118

Closed johnguzenko closed 4 years ago

johnguzenko commented 4 years ago

When I put any object which contains date field using ngx-webstorage to localstorage and try to get object back, the date field is string.

ghost commented 4 years ago

This is how it should work. whenever you retrieve something from SessionStorage/LocalStorage it's a string type, so it uses JSON.parse() internally to retrieve an object. JSON.parse doesn't have Date type so it becomes a string type. you have to make it by yourself