lib/kissy/5.0.0-alpha.3/lib/build/date/gregorian.js
function (field, amount) {
            if (!amount) {
                return;
            }
            var self = this;    // computer and retrieve original value
            // computer and retrieve original value
            var value = self.get(field);
            var min = self.getActualMinimum(field);
            var max = self.getActualMaximum(field);
            value = self.getRolledValue(value, amount, min, max);
            self.set(field, value);    // consider compute time priority
            // consider compute time priority
            switch (field) {
            case MONTH:
                adjustDayOfMonth(self);
                break;
            default:
                // other fields are set already when get
                self.updateFieldsBySet(field);
                break;
            }
        }
function (field, amount) {
            if (!amount) {
                return;
            }
            var self = this;    // computer and retrieve original value
            // computer and retrieve original value
            var value = self.get(field);
            var min = self.getActualMinimum(field);
            var max = self.getActualMaximum(field);
            value = self.getRolledValue(value, amount, min, max);
            self.set(field, value);    // consider compute time priority
            // consider compute time priority
            switch (field) {
            case MONTH:
                adjustDayOfMonth(self);
                break;
            default:
                // other fields are set already when get
                self.updateFieldsBySet(field);
                break;
            }
        }
function ( field , amount ) { if ( ! amount ) { return ; } var self = this ; // computer and retrieve original value // computer and retrieve original value var value = self . get ( field ) ; var min = self . getActualMinimum ( field ) ; var max = self . getActualMaximum ( field ) ; value = self . getRolledValue ( value , amount , min , max ) ; self . set ( field , value ) ; // consider compute time priority // consider compute time priority switch ( field ) { case MONTH : adjustDayOfMonth ( self ) ; break ; default : // other fields are set already when get self . updateFieldsBySet ( field ) ; break ; } }
Adds a signed amount to the specified calendar field without changing larger fields.
A negative roll amount means to subtract from field without changing
larger fields. If the specified amount is 0, this method performs nothing.



@example
var d = new GregorianCalendar();
d.set(1999, GregorianCalendar.AUGUST, 31);
// 1999-4-30
// Tuesday June 1, 1999
d.set(1999, GregorianCalendar.JUNE, 1);
d.add(Gregorian.WEEK_OF_MONTH,-1); // === d.add(Gregorian.WEEK_OF_MONTH,
d.get(Gregorian.WEEK_OF_MONTH));
// 1999-06-29


@param field the calendar field.
@param {Number} amount the signed amount to add to field.
Adds a signed amount to the specified calendar field without changing larger fields . A negative roll amount means to subtract from field without changing larger fields . If the specified amount is 0 this method performs nothing .