function runNotify(frequency) {
  if (localStorage.getItem('lastNotify') === null) {
    //Store timestamp
    localStorage.setItem('lastNotify', +new Date());
    return true;
  }

  const notifyTime = new Date(parseInt(localStorage.getItem('lastNotify')));
  const now = new Date();
  const diffTime = Math.abs(now - notifyTime);
  const minutesPassed = Math.ceil(diffTime / (1000 * 60));

  return minutesPassed > frequency ? true : false;
}
// Check how much time has passed since notication
Check how much time has passed since notication
Check how much time has passed since notication
function runNotify(frequency) {
  if (localStorage.getItem('lastNotify') === null) {
    localStorage.setItem('lastNotify', +new Date());
    return true;
  }
  const notifyTime = new Date(parseInt(localStorage.getItem('lastNotify')));
  const now = new Date();
  const diffTime = Math.abs(now - notifyTime);
  const minutesPassed = Math.ceil(diffTime / (1000 * 60));
  return minutesPassed > frequency ? true : false;
}
function runNotify ( frequency ) { if ( localStorage . getItem ( 'lastNotify' ) === null ) { localStorage . setItem ( 'lastNotify' , + new Date ( ) ) ; return true ; } const notifyTime = new Date ( parseInt ( localStorage . getItem ( 'lastNotify' ) ) ) ; const now = new Date ( ) ; const diffTime = Math . abs ( now - notifyTime ) ; const minutesPassed = Math . ceil ( diffTime / ( 1000 * 60 ) ) ; return minutesPassed > frequency ? true : false ; }
Check how much time has passed since notication
Check how much time has passed since notication
//Store timestamp