Node.js examples for Date:Week
Judge the date is in same week as another date
/**/*from w ww .j av a 2 s. c o m*/ * Judge the date is in same week as another date * @param {date} date * @return {Boolean} */ Date.prototype.isSameWeek = function(date) { var weekStart = this.getLastWeekday(); var weekEnd = weekStart.clone().addDays(7); return date >= weekStart && date < weekEnd; };