Title: DatePicker accepts out-of-range values entered from keyboard and fires ValueChangeEvent
Vaadin Version: 24.7.4
Description
I noticed a potentially unexpected behavior with DatePicker .
When min and max are configured, selecting a date through the date picker UI correctly restricts the user to the allowed range. However, when a date is entered manually from the keyboard, the component accepts a value outside the configured range and fires a ValueChangeEvent with that value.
Sample Code
DatePicker dp = new DatePicker();
add(dp);
dp.setMin(LocalDate.of(2026, 6, 5));
dp.setMax(LocalDate.of(2026, 6, 5));
dp.addValueChangeListener(event -> {
System.out.println(event.getValue());
});
Steps to Reproduce
- Open the view containing the
DatePicker. - Focus the field.
- Type
2026-06-15manually (or any date outside the configured range). - Press Enter or move focus away.
Expected Behavior
Since both min and max are set to 2026-06-05 , I would expect values outside that range to be rejected, or at least not propagated as a valid value through ValueChangeEvent .
Actual Behavior
The listener receives:
2026-06-05
2026-06-15
even though 2026-06-15 is outside the configured range.
The component becomes invalid, but the out-of-range value is still set and delivered to the ValueChangeListener .
Is this the intended behavior, or should out-of-range values be prevented from being set as the component value?