code: function compareDate(d, find, buffer, forceUTC) {
      var p, t, min, max, minOffset, maxOffset, override, capitalized, accuracy = 0, loBuffer = 0, hiBuffer = 0;
      p = getExtendedDate(find, null, null, forceUTC);
      if(buffer > 0) {
        loBuffer = hiBuffer = buffer;
        override = true;
      }
      if(!p.date.isValid()) return false;
      if(p.set && p.set.specificity) {
        DateUnits.forEach(function(u, i) {
          if(u.unit === p.set.specificity) {
            accuracy = u.multiplier(p.date, d - p.date) - 1;
          }
        });
        capitalized = simpleCapitalize(p.set.specificity);
        if(p.set['edge'] || p.set['shift']) {
          p.date['beginningOf' + capitalized]();
        }
        if(p.set.specificity === 'month') {
          max = p.date.clone()['endOf' + capitalized]().getTime();
        }
        if(!override && p.set['sign'] && p.set.specificity != 'millisecond') {
          // If the time is relative, there can occasionally be an disparity between the relative date
          // and "now", which it is being compared to, so set an extra buffer to account for this.
          loBuffer = 50;
          hiBuffer = -50;
        }
      }
      t   = d.getTime();
      min = p.date.getTime();
      max = max || (min + accuracy);
      max = compensateForTimezoneTraversal(d, min, max);
      return t >= (min - loBuffer) && t <= (max + hiBuffer);
    }
docs: Date comparison helpers