Declined
Last Updated: 10 Jan 2023 10:50 by ADMIN
Michael D
Created on: 22 Dec 2022 08:32
Category: Date/Time Pickers
Type: Bug Report
0
TimePicker widget sets wrong default max date

The TimePicker widget allows specifying a max date via its options. If none is specified, the widget uses a default max date (00:00 of the current day). However, since the selected value also use the current day for its date part, all selected values are bigger than the max value.

This means that when checking whether a selected value is smaller than the defined max value, the check will always fail, because e.g. 2022-12-22 12:00 is bigger than 2022-12-22 00:00. This DOJO demonstrates the behaviour (select a value and check the console output).

In my opinion, it would make more sense to set the default max date to either 23:59 or 00:00 of the following day.

3 comments
ADMIN
Peter Milchev
Posted on: 10 Jan 2023 10:50

Hi Michael,

Using 0 as an alternative for unlimited/max value is a common practice, especially when 0 does not have a meaning. For example, you cannot set the max-value to 0, otherwise, you will have nothing to select. 

In general, the date part is there just because the JavaScript date needs it, it is not considered in any calculations of the time picker, so it should not be a concern.

Regards,
Peter Milchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Michael D
Posted on: 03 Jan 2023 11:19

Even if the date part is ignored, 00:00 is still smaller than every other possible time value and therefore not suitable for a default max value.

ADMIN
Peter Milchev
Posted on: 28 Dec 2022 13:43

Hello Michael,

The min and max configurations are just for determining the options that will be rendered in the dropdown list. The date part of the properties is ignored so it does not matter which day is passed. 

Regards,
Peter Milchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.