I'm making a function to clear my local storage every month and set a 25 hour cooldown timeout so it wont activated again after executed but always got reset and keep executed everytime. Please help to fix this. Thanks
let cooldown = false;
const RECHARGE_TIME = 90000000; //25 hour cooldown
let today = new Date()
document.getElementById("todayDate").innerHTML = today.getDate();
if(today.getDate() === 1 && !cooldown){
clearHighScore();
startCooldown();
}
console.log(cooldown) //just to check the cooldown state
function clearHighScore() {
localStorage.clear();
}
function startCooldown() {
cooldown = true;
setTimeout (function(clearHighScore){ cooldown = false}, RECHARGE_TIME);
}