'Vaadin Flow DateTimePicker dirty inside CRUD

I am adding a com.vaadin.flow.component.datetimepicker.DateTimePicker to a com.vaadin.flow.component.crud.Crud. This appears to always mark the CRUD dirty. I noticed that things are all good when using a com.vaadin.flow.component.datepicker.DatePicker. This problem only shows for DateTimePicker. How should I cope with this?

DateTimePicker dtp = new DateTimePicker("When");
dtp.setStep(Duration.ofMillis(1));
// ...
binder.bind(dtp, new ValueProvider<MyEvent, LocalDateTime>() {
    @Override
    public LocalDateTime apply(final MyEvent source) {
        return source.getWhen();
    }
}, ...

So, DateTimePicker with millis step, provided with a LocalDateTime value.

Later Edit: I have looked further into the DateTimePicker.setPresentationValue(LocalDateTime) implementation and found that some JavaScript is being executed:

datePicker.getElement().executeJs("this.dispatchEvent(new CustomEvent('change', { bubbles: true }));");

Could this be it? Unfortunately, I am not familiar to Vaadin's internals, so unsure why is that required there.



Solution 1:[1]

Please see https://github.com/vaadin/flow-components/issues/1043 . You should be able to change your project's pom.xml to pick-up the v 14.7.1 version of the timepicker flow component with the appropriate fix.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sergiu