code: function(date, value, period) {
          this._validate(date, this.minMonth, this.minDay,
              _exports.local.invalidDate || _exports.regionalOptions[''].invalidDate);
          var y = (period === 'y' ? value : date.year());
          var m = (period === 'm' ? value : date.month());
          var d = (period === 'd' ? value : date.day());
          if (period === 'y' || period === 'm') {
              d = Math.min(d, this.daysInMonth(y, m));
          }
          return date.date(y, m, d);
      }
docs: Set a portion of the date.
  @memberof BaseCalendar
  @param date {CDate} The starting date.
  @param value {number} The new value for the period.
  @param period {string} One of 'y' for year, 'm' for month, 'd' for day.
  @return {CDate} The updated date.
  @throws Error if an invalid date or a different calendar used.