date after set on change

This commit is contained in:
Yuri Kuznetsov
2025-06-29 13:10:08 +03:00
parent 46db6c2260
commit a01f3333b3
+14
View File
@@ -144,6 +144,20 @@ class DateFieldView extends BaseFieldView {
// Timeout prevents the picker popping one when the duration field adjusts the date end.
setTimeout(() => {
/** @type {string} */
const from = this.model.attributes[this.params.after];
/** @type {string} */
const currentValue = this.model.attributes[this.name];
if (
from &&
currentValue &&
this.getDateTime().toMomentDate(currentValue)
.isBefore(this.getDateTime().toMomentDate(from))
) {
this.model.set(this.name, from);
}
this.datepicker.setStartDate(this.getStartDateForDatePicker());
}, 100);
});