DateTimePicker chops seconds and miliseconds at first use

I ran into a strange problem with the DateTimePicker component. I use a DateTimePicker on a form and when the form is initialized for the first time and a value is set, the seconds and millisecond are chopped off and replaced with zeros. This only happens the first time; when the form is reused, the seconds and milliseconds are maintained.

I’ve tried to analyze the issue by adding debug info in the value change listener and discovered that right after initially setting the value (with the correct value), the value change listener is fired again, but now with the seconds and milliseconds chopped off. When reusing the form, the value changer is only fired once (to set the new form value). When pausing execution during the second value change event, you can actually see the DateTimePicker showing the correct value (with seconds and milliseconds).

I’ve tried various things to work around the issue (setting and resetting the value in the form constructor and when reusing the form, using and not using the binder), but it still chops the seconds and milliseconds. It is as if the precision (step value) is not correctly honored at first use.

I’m using Vaadin 14.3.0 with the DateTimePicker configured as follows (in the form constructor):

    creationTimestamp = new DateTimePicker("Created at");
    creationTimestamp.setStep(Duration.ofMillis(1));

(the picker is actually bound to a Date field – with an appropriate conversion – but as I’ve also tried not using the binder this shouldn’t be part of the issue)

I have tried to reproduce this issue in Vaadin 14.4.0 but i couldn’t.

Strange, you can’t reproduce it. Just tried it again within our application (now updated to Vaadin 14.4.4) and it’s still reproducible; (milli)seconds get chopped. As said, this only happens after the form is first shown after creation; thereafter it’s fine.

The (spring boot) application makes use of a basic grid and form layout where the grid view creates the form and hides/shows it when an item is selected in the grid. Pretty similar to one of the demo applications…

Did you create a test application for this purpose? If so, can you share it with me so I can see if with your application I still get the same behavior? Maybe then we can try to determine if it’s perhaps environment, (GUI) set-up related, or something else.