lib/vendor/sugar.js
function(increment, fn) {
      var current = this.start.clone(), result = [], index = 0, params, isDay;
      if(isString(increment)) {
        current.advance(getDateParamsFromString(increment, 0), true);
        params = getDateParamsFromString(increment);
        isDay = increment.toLowerCase() === 'day';
      } else {
        params = { 'milliseconds': increment };
      }
      while(current <= this.end) {
        result.push(current);
        if(fn) fn(current, index);
        if(isDay && callDateGet(current, 'Hours') === 23) {
          // When DST traversal happens at 00:00 hours, the time is effectively
          // pushed back to 23:00, meaning 1) 00:00 for that day does not exist,
          // and 2) there is no difference between 23:00 and 00:00, as you are
          // "jumping" around in time. Hours here will be reset before the date
          // is advanced and the date will never in fact advance, so set the hours
          // directly ahead to the next day to avoid this problem.
          current = current.clone();
          callDateSet(current, 'Hours', 48);
        } else {
          current = current.clone().advance(params, true);
        }
        index++;
      }
      return result;
    }
function(increment, fn) {
      var current = this.start.clone(), result = [], index = 0, params, isDay;
      if(isString(increment)) {
        current.advance(getDateParamsFromString(increment, 0), true);
        params = getDateParamsFromString(increment);
        isDay = increment.toLowerCase() === 'day';
      } else {
        params = { 'milliseconds': increment };
      }
      while(current <= this.end) {
        result.push(current);
        if(fn) fn(current, index);
        if(isDay && callDateGet(current, 'Hours') === 23) {
          // When DST traversal happens at 00:00 hours, the time is effectively
          // pushed back to 23:00, meaning 1) 00:00 for that day does not exist,
          // and 2) there is no difference between 23:00 and 00:00, as you are
          // "jumping" around in time. Hours here will be reset before the date
          // is advanced and the date will never in fact advance, so set the hours
          // directly ahead to the next day to avoid this problem.
          current = current.clone();
          callDateSet(current, 'Hours', 48);
        } else {
          current = current.clone().advance(params, true);
        }
        index++;
      }
      return result;
    }
function ( increment , fn ) { var current = this . start . clone ( ) , result = [ ] , index = 0 , params , isDay ; if ( isString ( increment ) ) { current . advance ( getDateParamsFromString ( increment , 0 ) , true ) ; params = getDateParamsFromString ( increment ) ; isDay = increment . toLowerCase ( ) === 'day' ; } else { params = { 'milliseconds' : increment } ; } while ( current <= this . end ) { result . push ( current ) ; if ( fn ) fn ( current , index ) ; if ( isDay && callDateGet ( current , 'Hours' ) === 23 ) { // When DST traversal happens at 00:00 hours, the time is effectively // pushed back to 23:00, meaning 1) 00:00 for that day does not exist, // and 2) there is no difference between 23:00 and 00:00, as you are // "jumping" around in time. Hours here will be reset before the date // is advanced and the date will never in fact advance, so set the hours // directly ahead to the next day to avoid this problem. current = current . clone ( ) ; callDateSet ( current , 'Hours' , 48 ) ; } else { current = current . clone ( ) . advance ( params , true ) ; } index ++ ; } return result ; }
*
@method every(<increment>, [fn])
@returns Array
@short Iterates through the DateRange for every <increment>, calling [fn] if it is passed. Returns an array of each increment visited.
@extra When <increment> is a number, increments will be to the exact millisecond. <increment> can also be a string in the format %{number} {unit}s%, in which case it will increment in the unit specified. Note that a discrepancy exists in the case of months, as %(2).months()% is an approximation. Stepping through the actual months by passing %"2 months"% is usually preferable in this case.
@example

Date.range('2003-01', '2003-03').every("2 months") -> [...]

*
* @method every ( <increment > [ fn ] ) @returns Array @short Iterates through the DateRange for every <increment > calling [ fn ] if it is passed . Returns an array of each increment visited . @extra When <increment > is a number increments will be to the exact millisecond . <increment > can also be a string in the format % { number } { unit } s% in which case it will increment in the unit specified . Note that a discrepancy exists in the case of months as % ( 2 ) . months () % is an approximation . Stepping through the actual months by passing % 2 months % is usually preferable in this case . @example