lib/vendor/sugar.js
function checkMonthTraversal(date, targetMonth) {
    if(targetMonth < 0) {
      targetMonth = targetMonth % 12 + 12;
    }
    if(targetMonth % 12 != callDateGet(date, 'Month')) {
      callDateSet(date, 'Date', 0);
    }
  }
function checkMonthTraversal(date, targetMonth) {
    if(targetMonth < 0) {
      targetMonth = targetMonth % 12 + 12;
    }
    if(targetMonth % 12 != callDateGet(date, 'Month')) {
      callDateSet(date, 'Date', 0);
    }
  }
function checkMonthTraversal ( date , targetMonth ) { if ( targetMonth < 0 ) { targetMonth = targetMonth % 12 + 12 ; } if ( targetMonth % 12 != callDateGet ( date , 'Month' ) ) { callDateSet ( date , 'Date' , 0 ) ; } }
If the month is being set, then we don't want to accidentally traverse into a new month just because the target month doesn't have enough days. In other words, "5 months ago" from July 30th is still February, even though there is no February 30th, so it will of necessity be February 28th (or 29th in the case of a leap year).
If the month is being set then we don t want to accidentally traverse into a new month just because the target month doesn t have enough days . In other words 5 months ago from July 30th is still February even though there is no February 30th so it will of necessity be February 28th ( or 29th in the case of a leap year ) .