Open bananer opened 1 month ago
I would agree that it could be confusing, but unfortunately at the moment it's a documented behaviour and some users could rely on it. We would be able to change it with the upcoming major release. As a workaround you can set an initial value after initialisation of the field:
DatePicker datePicker = new DatePicker();
datePicker.setValue(LocalDate.now());
Description
Passing an initial value to the
DatePicker
constructur sets that initial value also as the "empty value". Consequently, when the value is unchanged (or changed back to the initial value) the DatePicker returnstrue
fromisEmpty()
Expected outcome
DatePicker with initialValue returns fals from isEmpty()
Minimal reproducible example
Workaround:
Steps to reproduce
see above
Environment
Vaadin version(s): 24.3.12 OS: Debian 12
Browsers
Issue is not browser related