web-components icon indicating copy to clipboard operation
web-components copied to clipboard

[time-picker] Add option to validate by step

Open Haprog opened this issue 5 years ago • 1 comments

Currently the step property in time picker only affects two things:

  1. options in the dropdown (or hides it if step is less than 15 min)
  2. the value resolution/precision (format of the value property; does it include milliseconds, seconds, minutes)

But it doesn't affect validity of the value (unlike step in vaadin-number-field). So if you e.g. set step to 3600 (1 hour) the dropdown shows only exact hours, but you can still input for example "10:05" and it will stay in the input and the input will stay valid and value property will get updated to "10:05".

The current behaviour is probably ok as a default and has use cases when you might want to show only some values in the dropdown but want to allow more precise manual input.

My suggestion is to add a new feature like validate-by-step which would make the field become invalid if the given value does not match the step (in cases when you only want to allow specific exact intervals of values to be given).

Haprog avatar Jan 09 '20 08:01 Haprog

I find it strange to have a TimePicker without any dropdown. It feels like there is something not working in that cases. So I think it would be nice not only to have the possibility to choose to validate according to the steps, but also to have a separate setting for the data pattern and the steps in the dropdown.

hons82 avatar Nov 05 '21 11:11 hons82