Determine whether Date object is today - Node.js Date

Node.js examples for Date:Day

Description

Determine whether Date object is today

Demo Code


/**/* ww  w.j  a  va2  s.  c  o  m*/
 * @description Determine whether Date object is today.
 * @param {Date} day: Day to test.
 * @returns {Boolean}
*/
isToday: function (date) {
  var now = new Date();
  return date.getMonth() === now.getMonth()
      && date.getDate() === now.getDate();
}

Related Tutorials