Is form input date before now x minutes - Node.js HTML

Node.js examples for HTML:Form

Description

Is form input date before now x minutes

Demo Code

function isBeforeNowxMin(inputDay, inputHour, inputMinute, allowedMinutes) {
  if(inputDay==null || inputDay==''){
        return false;
  }/*  w ww. j ava2  s  . com*/
  var now = new Date();
  var date=new Date();
  var myDate_array=inputDay.split("/");
  date.setFullYear(myDate_array[0], myDate_array[1]-1, myDate_array[2]);
  if (!(inputHour==null || inputHour =='' || inputHour == 0)) date.setHours(inputHour);
  if (!(inputMinute==null || inputMinute =='' || inputMinute == 0)) date.setMinutes(inputMinute);
  date.setSeconds(0.0);
  now.setSeconds(0.0);
    if ((now.getTime() - date.getTime()) > allowedMinutes*60000) {
      return true;
    }  
  else return false;
}

Related Tutorials