Skip to content

Commit cb34131

Browse files
committed
refactor: revert set value order change and validate on value change
1 parent bca1d20 commit cb34131

File tree

1 file changed

+5
-3
lines changed
  • vaadin-date-time-picker-flow-parent/vaadin-date-time-picker-flow/src/main/java/com/vaadin/flow/component/datetimepicker

1 file changed

+5
-3
lines changed

vaadin-date-time-picker-flow-parent/vaadin-date-time-picker-flow/src/main/java/com/vaadin/flow/component/datetimepicker/DateTimePicker.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public DateTimePicker(LocalDateTime initialDateTime, Locale locale) {
354354
}
355355

356356
private void addValidationListeners() {
357-
getElement().addEventListener("change", e -> validate(true));
357+
addValueChangeListener(e -> validate());
358358
getElement().addEventListener("unparsable-change", e -> validate(true));
359359
}
360360

@@ -379,9 +379,11 @@ public void setValue(LocalDateTime value) {
379379
var shouldFireValidationStatusChangeEvent = oldValue == null
380380
&& value == null
381381
&& (isInputUnparsable() || isInputIncomplete());
382-
synchronizeChildComponentValues(value);
383-
validate(shouldFireValidationStatusChangeEvent);
384382
super.setValue(value);
383+
synchronizeChildComponentValues(value);
384+
if (shouldFireValidationStatusChangeEvent) {
385+
validate(true);
386+
}
385387
}
386388

387389
/**

0 commit comments

Comments
 (0)