jmix icon indicating copy to clipboard operation
jmix copied to clipboard

TypedTimePicker & TypedDateTimePicker - fix format

Open glebfox opened this issue 3 years ago • 1 comments

See TODOs

Investigation

DateTimePicker and TimePicker do not have methods for setting time formats like:

setFormat(String) // setFormat("hh:mm:ss")

Vaadin suggests to use two methods to change format in TimePicker:

timePicker.setStep(Duration.ofSeconds(1)); // to use format with seconds
timePicker.setLocale(Locale.GERMANY); // to show 24 hours

And in DateTimePicker:

DatePicker.DatePickerI18n datePickerI18n = new DatePicker.DatePickerI18n();
datePickerI18n.setDateFormat("MM/dd/yyyy");

dateTimeField.setDatePickerI18n(datePickerI18n); // custom date format
dateTimeField.setStep(Duration.ofSeconds(1)); // to use format with seconds
dateTimeField.setLocale(Locale.GERMANY); // to use 24h format

Internal setI18n() method does not allow you providing methods for formatting and parsing custom format.

Vaadin has issues:

  • TimePicker https://github.com/vaadin/flow-components/issues/1068
  • DateTimePicker https://github.com/vaadin/flow-components/issues/3721
  • DateTimePicker https://github.com/vaadin/flow-components/issues/2417

glebfox avatar Jul 19 '22 11:07 glebfox

We're waiting for vaadin fixes

gorbunkov avatar Dec 12 '22 08:12 gorbunkov

@glebfox we had request from community for seconds to be displayed in timepicker that is currently looks unavailable

syncro avatar May 27 '25 14:05 syncro