BUG: TelerikTimePicker resets the date to Today with every time change

2 Answers 241 Views
TimePicker
Roland
Top achievements
Rank 3
Iron
Iron
Veteran
Roland asked on 27 Jan 2022, 10:43 PM | edited on 27 Jan 2022, 10:45 PM

The component can bind to a DateTime variable.

The expected behaviour is that only the time part is updated, so that the actual date is preserved.

For instance if I want to want to let the user set a time for an appointment tomorrow, the appointment should not move to today because the time was changed

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimo
Telerik team
answered on 02 Feb 2022, 11:52 AM

Hi Roland,

The TimePicker assumes that the application logic is not interested in the Date portion of the value. If the Date portion matters, there are some options:

  • Use a DateTimePicker instead, so that the Date portion is visible and controllable by the user.
  • Ignore the new Date portion and apply only the new Time portion in ValueChanged.
  • Set and store the Date portion separately, so that you can start ignoring the Date portion in the TimePicker value.

On a side note, the TimePicker will also support TimeOnly in the future.

Regards,
Dimo
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.

Roland
Top achievements
Rank 3
Iron
Iron
Veteran
commented on 02 Feb 2022, 12:15 PM

"The TimePicker assumes that the application logic is not interested in the Date portion of the value."
Like when you change the time of an appointment on  a given day? Not a good assumption in my book.

"Set and store the Date portion separately".
That is my current workaround.

"TimePicker will also support TimeOnly".
That would be more predictable, but I still think that a TimePicker that (also) supports DateTime databinding is more flexible and should never overwrite the date part.

Shahram
Top achievements
Rank 1
commented on 20 Jun 2023, 03:49 PM | edited

Hi Roland,
Thanks for your comment and suggesting a few workarounds. But, Do you have a plan to fix this bug? It seems that "TimePicker assumes that the application logic is not interested in the Date portion of the value" is not a valid assumption.
0
Marin Bratanov
Telerik team
answered on 30 Jan 2022, 12:08 PM

Hi Roland,

The TimePicker uses the Date portion of the provided DateTime field. If the NOW button is clicked, however, the date portion will be replaced with the current one.

If you want to customize the behavior, you can use the ValueChanged event to transfer only portions of the DateTime object as your business logic requires.

Regards,
Marin Bratanov
Progress Telerik

Learn about the important changes coming in UI for Blazor 3.0 in January 2022!
Roland
Top achievements
Rank 3
Iron
Iron
Veteran
commented on 31 Jan 2022, 10:18 AM

It is not just the NOW button, if you enter the value manually the date is changed.
Tags
TimePicker
Asked by
Roland
Top achievements
Rank 3
Iron
Iron
Veteran
Answers by
Dimo
Telerik team
Marin Bratanov
Telerik team
Share this question
or