Issue
I was trying to set UNIX
time in local storage by:
let dt: number = Date.now();
localStorage.setItem('logged', dt+864000000);
Returning with error: Argument of type 'number' is not assignable to parameter of type 'string'
It's giving the same error when i use getItem
to read the logged
data.
Any solution?
Solution
Just try this
let dt: number = Date.now();
localStorage.setItem('logged', ""+dt+864000000);
Hope this works for you
Answered By - Mustafa Lokhandwala
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.