Jeff6301705
Posts: 0
Joined: Sun Oct 06, 2013 5:27 am

How would I put an indicator on a page that's loaded with local storage variables and have it come back as marked one wa

I want to have a radio button or a toggle that will stay in the listed array that shows either one or the other, but have it stay that way so when I come back to it, say a day later it's still marked with how I left it the last time I was there.

Jeff6301705
Posts: 0
Joined: Sun Oct 06, 2013 5:27 am

How would I put an indicator on a page that's loaded with local storage variables and have it come back as marked one wa

If all the items are in string form how will that work, will I have to convert all my information into object to time them?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

How would I put an indicator on a page that's loaded with local storage variables and have it come back as marked one wa

Jeff,

You get current date:prenow = new Date().getTime();/pre
Save it as Last visit date, for example:prelocalStorage.setItem("lastEnter", now);/pre
When next visit, read it and subtract the current date from it:prevar lastEnter = localStorage.getItem("lastEnter");
var difference = new Date.getDate() - lastEnter;/pre
Now the difference between two dates in milliseconds is stored in 'difference' variable. You can convert it into days, dividing by (1000 60 60 * 24).

Return to “Issues”