Skip to content

DateTimePicker is reporting as invalid after setting a valid value programmatically if it was previously invalid #8516

@davidef

Description

@davidef

Description

DateTimePicker is reporting as invalid after setting a valid value programmatically if it was previously invalid (for example the user before selected only the date)

Expected outcome

the status should be valid after programmatically set a valid value

Minimal reproducible example

DateTimePicker dateTimePicker = new DateTimePicker();
dateTimePicker.addValueChangeListener(e -> {
	Notification.show("value change: " + e.getValue());
});
add(dateTimePicker);

Button setValidValue = new Button("Set valid value");
setValidValue.addClickListener(e -> {
	dateTimePicker.setValue(LocalDateTime.of(2000, 1, 1, 1, 0));
});
add(setValidValue);

Button checkValid = new Button("Check valid");
checkValid.addClickListener(e -> {
	Notification.show("Is invalid: " + dateTimePicker.isInvalid());
});
add(checkValid);

Steps to reproduce

  1. Select only the date
  2. The field is as expected invalid
  3. Set a valid value programmatically
  4. The field report that is invalid but it instead it contains a valid value

Environment

Vaadin version(s): 25.0.3

Browsers

Issue is not browser related

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions