From a01f3333b34a6a9103d9e5ce076c1b543552a9f4 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Sun, 29 Jun 2025 13:10:08 +0300 Subject: [PATCH] date after set on change --- client/src/views/fields/date.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/client/src/views/fields/date.js b/client/src/views/fields/date.js index 2681c3315e..d9266ef841 100644 --- a/client/src/views/fields/date.js +++ b/client/src/views/fields/date.js @@ -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); });