Javascript Date isXMinutesBeforeNow(minutes)

Description

Javascript Date isXMinutesBeforeNow(minutes)

Date.prototype.isXMinutesBeforeNow = function(minutes)
{
  minutes = parseInt(minutes);//ww  w .jav a 2 s .  co  m
  if (minutes !== minutes){
    console.warn('Date.isXMinutesBeforeNow: @param: minutes is NaN');
    return true;
  }
  
  var d = Date.now();

  return (d - this) > (parseInt(minutes) * 60 *1000);
}



PreviousNext

Related