/* Adjust one of the date sub-fields.
556486
function(id, offset, period) {
		var target = $(id),
			inst = this._getInst(target[0]);

		if (this._isDisabledDatepicker(target[0])) {
			return;
		}
		this._adjustInstDate(inst, offset +
			(period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning
			period);
		this._updateDatepicker(inst);
	}
1125273
function( inst ) {
            var stepMonths = this._get( inst, "stepMonths" ),
                id = "#" + inst.id.replace( /\\\\/g, "\\" );
            inst.dpDiv.find( "[data-handler]" ).map( function() {
                var handler = {
                    prev: function() {
                        $.datepicker._adjustDate( id, -stepMonths, "M" );
                    },
                    next: function() {
                        $.datepicker._adjustDate( id, +stepMonths, "M" );
                    },
                    hide: function() {
                        $.datepicker._hideDatepicker();
                    },
                    today: function() {
                        $.datepicker._gotoToday( id );
                    },
                    selectDay: function() {
                        $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this );
                        return false;
                    },
                    selectMonth: function() {
                        $.datepicker._selectMonthYear( id, this, "M" );
                        return false;
                    },
                    selectYear: function() {
                        $.datepicker._selectMonthYear( id, this, "Y" );
                        return false;
                    }
                };
                $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] );
            } );
        }
1244985
public void setDate(int index, Date value)
   {
      set(selectField(ResourceFieldLists.CUSTOM_DATE, index), value);
   }
1051328
boolean shift() {
		if (!it.hasNext()) {
			return false;
		}
		head = it.next();
		comparable = DateValueComparison.comparable(head);
		return true;
	}
621885
def adjustRange(self, recursive=True):
        
        if ( self.adjustmentsBlocked('range') ):
            return
        
        if ( self.itemStyle() == self.ItemStyle.Group ):
            dateStart = self.dateStart()
            dateEnd   = self.dateEnd()
            first     = True
            
            for c in range(self.childCount()):
                child       = self.child(c)
                
                if ( first ):
                    dateStart = child.dateStart()
                    dateEnd   = child.dateEnd()
                    first     = False
                else:
                    dateStart   = min(child.dateStart(), dateStart)
                    dateEnd     = max(child.dateEnd(), dateEnd)
            
            self._dateStart = dateStart
            self._dateEnd   = dateEnd
            
            self.sync()
        
        if ( self.parent() and recursive ):
            self.parent().adjustRange(True)
1250677
private void setDateControl(DateControl control) {
        requireNonNull(control);

        control.addEventFilter(RequestEvent.REQUEST,
                evt -> addEvent(evt, LogEntryType.REQUEST_EVENT));
        control.addEventFilter(LoadEvent.LOAD,
                evt -> addEvent(evt, LogEntryType.LOAD_EVENT));

        // listen to calendars

        for (Calendar calendar : control.getCalendars()) {
            calendar.addEventHandler(calendarListener);
        }

        ListChangeListener<? super Calendar> l = change -> {
            while (change.next()) {
                if (change.wasAdded()) {
                    for (Calendar c : change.getAddedSubList()) {
                        c.addEventHandler(calendarListener);
                    }
                } else if (change.wasRemoved()) {
                    for (Calendar c : change.getRemoved()) {
                        c.removeEventHandler(calendarListener);
                    }
                }
            }
        };

        control.getCalendars().addListener(l);

        Bindings.bindBidirectional(datePicker.valueProperty(),
                control.dateProperty());
        Bindings.bindBidirectional(todayPicker.valueProperty(),
                control.todayProperty());
        Bindings.bindBidirectional(timeField.valueProperty(),
                control.timeProperty());
        timeField.setDisable(false);
    }
1220871
function adjustDateTime( $hour, $minute = 0, $second = 0, $month = 0, $day = 0, $year = 0 )
    {
        $arr = getdate( $this->DateTime );
        $date = mktime( $hour + $arr['hours'], $minute + $arr['minutes'], $second + $arr['seconds'],
                        $month + $arr['mon'], $day + $arr['mday'], $year + $arr['year'] );
        $this->DateTime = $date;
    }
466034
@UiHandler("m_dateModifiedEndDateBox")
    protected void onDateModifiedEndChange(ValueChangeEvent<Date> event) {

        if (event.getValue() != null) {
            m_tabHandler.setDateModifiedEnd(event.getValue().getTime());
        } else {
            // if the field is empty take the max value
            m_tabHandler.setDateModifiedEnd(-1L);
        }
    }
852381
@Override
	public LocalDate getAdjustedDate(LocalDate date, DateRollConvention dateRollConvention) {
		if(dateRollConvention == DateRollConvention.UNADJUSTED) {
			return date;
		}
		else if(dateRollConvention == DateRollConvention.MODIFIED_FOLLOWING) {
			LocalDate adjustedDate = getAdjustedDate(date, DateRollConvention.FOLLOWING);
			if (adjustedDate.getMonth() != date.getMonth()){
				return getAdjustedDate(date, DateRollConvention.PRECEDING);
			} else {
				return adjustedDate;
			}
		}
		else if(dateRollConvention == DateRollConvention.MODIFIED_PRECEDING) {
			LocalDate adjustedDate = getAdjustedDate(date, DateRollConvention.PRECEDING);
			if (adjustedDate.getMonth() != date.getMonth()) {
				return getAdjustedDate(date, DateRollConvention.FOLLOWING);
			} else {
				return adjustedDate;
			}
		}
		else if(dateRollConvention == DateRollConvention.FOLLOWING || dateRollConvention == DateRollConvention.PRECEDING) {
			int adjustment = dateRollConvention == DateRollConvention.FOLLOWING ? 1 : -1;
			LocalDate adjustedDate = date;
			while(!isBusinessday(adjustedDate)) {
				adjustedDate = adjustedDate.plusDays(adjustment);
			}
			return adjustedDate;
		}

		throw new IllegalArgumentException("Unknown date roll convention.");
	}
670667
public LocalDate getAdjustedDate(LocalDate baseDate, String dateOffsetCode, DateRollConvention dateRollConvention) {
		return getAdjustedDate(createDateFromDateAndOffsetCode(baseDate, dateOffsetCode), dateRollConvention);
	}
580190
@UiHandler("m_dateCreatedStartDateBox")
    protected void onDateCreatedStartChange(ValueChangeEvent<Date> event) {

        if (event.getValue() != null) {
            m_tabHandler.setDateCreatedStart(event.getValue().getTime());
        } else {
            // if the field is empty take the min value
            m_tabHandler.setDateCreatedStart(-1L);
        }
    }
191435
public Calendar adjustDate(final Calendar startDate, final int increment, final NonWorkingDayChecker<Calendar> checker) {
        final Calendar cal = (Calendar) startDate.clone();

        while (checker.isNonWorkingDay(cal)) {
            cal.add(Calendar.DAY_OF_MONTH, increment);
        }

        return cal;
    }
501540
function(event) {
		var onSelect, dateStr, sel,
			inst = $.datepicker._getInst(event.target),
			handled = true,
			isRTL = inst.dpDiv.is(".ui-datepicker-rtl");

		inst._keyEvent = true;
		if ($.datepicker._datepickerShowing) {
			switch (event.keyCode) {
				case 9: $.datepicker._hideDatepicker();
						handled = false;
						break; // hide on tab out
				case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." +
									$.datepicker._currentClass + ")", inst.dpDiv);
						if (sel[0]) {
							$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
						}

						onSelect = $.datepicker._get(inst, "onSelect");
						if (onSelect) {
							dateStr = $.datepicker._formatDate(inst);

							// trigger custom callback
							onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
						} else {
							$.datepicker._hideDatepicker();
						}

						return false; // don't submit the form
				case 27: $.datepicker._hideDatepicker();
						break; // hide on escape
				case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
							-$.datepicker._get(inst, "stepBigMonths") :
							-$.datepicker._get(inst, "stepMonths")), "M");
						break; // previous month/year on page up/+ ctrl
				case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
							+$.datepicker._get(inst, "stepBigMonths") :
							+$.datepicker._get(inst, "stepMonths")), "M");
						break; // next month/year on page down/+ ctrl
				case 35: if (event.ctrlKey || event.metaKey) {
							$.datepicker._clearDate(event.target);
						}
						handled = event.ctrlKey || event.metaKey;
						break; // clear on ctrl or command +end
				case 36: if (event.ctrlKey || event.metaKey) {
							$.datepicker._gotoToday(event.target);
						}
						handled = event.ctrlKey || event.metaKey;
						break; // current on ctrl or command +home
				case 37: if (event.ctrlKey || event.metaKey) {
							$.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
						}
						handled = event.ctrlKey || event.metaKey;
						// -1 day on ctrl or command +left
						if (event.originalEvent.altKey) {
							$.datepicker._adjustDate(event.target, (event.ctrlKey ?
								-$.datepicker._get(inst, "stepBigMonths") :
								-$.datepicker._get(inst, "stepMonths")), "M");
						}
						// next month/year on alt +left on Mac
						break;
				case 38: if (event.ctrlKey || event.metaKey) {
							$.datepicker._adjustDate(event.target, -7, "D");
						}
						handled = event.ctrlKey || event.metaKey;
						break; // -1 week on ctrl or command +up
				case 39: if (event.ctrlKey || event.metaKey) {
							$.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
						}
						handled = event.ctrlKey || event.metaKey;
						// +1 day on ctrl or command +right
						if (event.originalEvent.altKey) {
							$.datepicker._adjustDate(event.target, (event.ctrlKey ?
								+$.datepicker._get(inst, "stepBigMonths") :
								+$.datepicker._get(inst, "stepMonths")), "M");
						}
						// next month/year on alt +right
						break;
				case 40: if (event.ctrlKey || event.metaKey) {
							$.datepicker._adjustDate(event.target, +7, "D");
						}
						handled = event.ctrlKey || event.metaKey;
						break; // +1 week on ctrl or command +down
				default: handled = false;
			}
		} else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home
			$.datepicker._showDatepicker(this);
		} else {
			handled = false;
		}

		if (handled) {
			event.preventDefault();
			event.stopPropagation();
		}
	}
301656
function filterDate({
  data,
  value,
  disabledArr,
  minDate,
  maxDate,
  oldData = {},
  props,
  columns,
}) {
  const disabledArrNew = parseDisabledArr(disabledArr);
  if (columns[0] === 'Y') {
    const year = value[0].value;
    let month;
    let yearData = data[0];
    let monthData;
    if (columns.length >= 2) {
      monthData = getMonthsByYear({ year, minDate, maxDate }).map(item => ({
        value: item.value,
        text: `${addZero(item.text)}${locale[props.locale].surfix.M}`,
      }));
      month = value[1].value;
    }
    let dayData;
    if (columns.length >= 3) {
      dayData = getDaysByMonth({
        year, month, minDate, maxDate,
      });
    }
    if (disabledArrNew.startEnd || disabledArrNew.minTime || disabledArrNew.maxTime) {
      if (oldData.yearData) {
        ({ yearData } = oldData);
      } else {
        yearData = filterYear(yearData, { disabledDateObj: disabledArrNew, minDate, maxDate });
      }
      if (monthData) {
        if (oldData.monthData) {
          ({ monthData } = oldData);
        } else {
          const monthArr = filterMonth(monthData, year, disabledArrNew);
          monthData = monthArr.length ? monthArr : monthData;
        }
      }

      if (dayData) {
        const dayArr = filterDay(dayData, year, month, disabledArrNew);
        dayData = dayArr.length ? dayArr : dayData;
        const unit = locale[props.locale].surfix.D;
        dayData = dayData.map(item => ({
          ...item,
          text: addZero(item.text) + (unit || ''),
        }));
      }
    }
    if (disabledArrNew.minTime >= disabledArrNew.maxTime) {
      warn('Datetime: Please check your disabledDate props');
      return [];
    }
    if (!yearData.length) {
      return [];
    }
    const outArr = [yearData];
    if (monthData) {
      outArr.push(monthData);
      if (dayData) {
        outArr.push(dayData);
      }
    }

    if (data[3]) {
      outArr.push(data[3]);
    }
    return outArr;
  }
  if (['YMD', 'YMDW'].indexOf(columns[0]) !== -1) {
    const newData = [...data];
    newData[0] = filterYMDDay(newData[0], disabledArr);

    return newData;
  }
  return data;
}
771159
def rollforward(self, date):
        """"""
        if self.onOffset(date):
            return date
        else:
            return date + QuarterEnd(month=self.month)
650827
function(inst, newTime) {
            var altField = this._get(inst, 'altField');
            if (altField) { // update alternate field too
                $(altField).each(function(i,e) {
                    $(e).val(newTime);
                });
            }
        }
1122591
def _adjust_n_years(other, n, month, reference_day):
    """"""
    if n > 0:
        if other.month < month or (other.month == month and
                                   other.day < reference_day):
            n -= 1
    else:
        if other.month > month or (other.month == month and
                                   other.day > reference_day):
            n += 1
    return n