Using Javascript again... I know (this is becoming more complicated then I thought it would be
)
So in my game shops restock every day but I need to make it know that the script has run for the day already.
So I assume the only solution is a cookie that expires at midnight...
how would I go about doing this?
I tried this:
var localVal = localStorage.getItem('textcraftday');
if(localVal == null){
alert("Hey!")
// execute the function
}else{
var tempd = new Date();
var str = tempd.getDay() + tempd.getMonth() + tempd.getFullYear();
if(localVal.localeCompare(str) == -1){
//execute function
localStorage.setItem('textcraftday',str);
}
}