I am trying to make it so my script runs once per day at most. Here is what I currently have:
var q = new Date();
var m = q.getMonth();
var d = q.getDate();
var y = q.getFullYear();
var currdate = new Date(y,m,d);
if (GM_getValue("date", "") < currdate) {
GM_setValue("date", currdate);
console.log("Set new date. Continuing to run script");
}
else {
console.log("No need to fetch data. Quitting");
throw new Error("Halted Script.");
}
But it does not seem to be working. Would it be better to store how many days have passed since epoch as done Here?