DateTimeFieldsState DateTimeFieldsState::restoreFormControlState(const FormControlState& state) { DateTimeFieldsState dateTimeFieldsState; dateTimeFieldsState.setYear(getNumberFromFormControlState(state, 0)); dateTimeFieldsState.setMonth(getNumberFromFormControlState(state, 1)); dateTimeFieldsState.setDayOfMonth(getNumberFromFormControlState(state, 2)); dateTimeFieldsState.setHour(getNumberFromFormControlState(state, 3)); dateTimeFieldsState.setMinute(getNumberFromFormControlState(state, 4)); dateTimeFieldsState.setSecond(getNumberFromFormControlState(state, 5)); dateTimeFieldsState.setMillisecond(getNumberFromFormControlState(state, 6)); dateTimeFieldsState.setWeekOfYear(getNumberFromFormControlState(state, 7)); dateTimeFieldsState.setAMPM(getAMPMFromFormControlState(state, 8)); return dateTimeFieldsState; }
void DateTimeEditElement::setOnlyYearMonthDay(const DateComponents& date) { ASSERT(date.type() == DateComponents::Date); if (!m_editControlOwner) return; DateTimeFieldsState dateTimeFieldsState = valueAsDateTimeFieldsState(); dateTimeFieldsState.setYear(date.fullYear()); dateTimeFieldsState.setMonth(date.month() + 1); dateTimeFieldsState.setDayOfMonth(date.monthDay()); setValueAsDateTimeFieldsState(dateTimeFieldsState); m_editControlOwner->editControlValueChanged(); }
void DateTimeYearFieldElement::populateDateTimeFieldsState(DateTimeFieldsState& dateTimeFieldsState) { dateTimeFieldsState.setYear(hasValue() ? valueAsInteger() : DateTimeFieldsState::emptyValue); }