local storage limited to handle only string key/value pairs you can do like below using JSON.stringify and while getting value JSON.parse
var testObject = {name:"test", time:"Date 2017-02-03T08:38:04.449Z"};
Put the object into storage:
localStorage.setItem('testObject', JSON.stringify(testObject));
Or
localStorage['testObject'] = JSON.stringify(testObject));
Retrieve the object from storage:
var retrievedObject = localStorage.getItem('testObject');
Or
var retrievedObject = localStorage['testObject'];
console.log('retrievedObject: ', JSON.parse(retrievedObject));
var testObject = {name:"test", time:"Date 2017-02-03T08:38:04.449Z"};
Put the object into storage:
localStorage.setItem('testObject', JSON.stringify(testObject));
Or
localStorage['testObject'] = JSON.stringify(testObject));
Retrieve the object from storage:
var retrievedObject = localStorage.getItem('testObject');
Or
var retrievedObject = localStorage['testObject'];
console.log('retrievedObject: ', JSON.parse(retrievedObject));