Unplanned
Last Updated: 01 Nov 2022 08:08 by Niko
Jasmin
Created on: 05 Feb 2021 14:12
Category: TimePicker
Type: Bug Report
3
Writing the time with the keyboard changes the date portion to the current date

When you type the time in the time picker, it changes the date to the current date, while it should change only the time portion.

---

ADMIN EDIT

A workaround is to use the original year, month and date portions of the view-model field and capture the time portion from the ValueChanged event:

@selectedTime?.ToString("F")

<TelerikTimePicker Min="@Min" Max="@Max" Format="hh:mm:ss tt" 
                   Value="@selectedTime" ValueChanged="@( (DateTime? v) => ValueChangedHandler(v) )">
</TelerikTimePicker>

@code {
    public DateTime Min = new DateTime(1900, 1, 1, 10, 0, 0);
    public DateTime Max = new DateTime(1900, 1, 1, 20, 0, 0);
    public DateTime? selectedTime { get; set; } = new DateTime(1900, 1, 1, 12, 0, 0);

    void ValueChangedHandler(DateTime? updatedTime)
    {
        selectedTime = new DateTime(
                selectedTime.Value.Year,
                selectedTime.Value.Month,
                selectedTime.Value.Day,
                updatedTime.Value.Hour,
                updatedTime.Value.Minute,
                updatedTime.Value.Second
            );
    }
}

---

3 comments
Niko
Posted on: 01 Nov 2022 08:08

Thanks for the replay Dimo,

yes I took the workaround with ValueChanged. Works fine.

Looking forward for your updates. Thanks!

ADMIN
Dimo
Posted on: 01 Nov 2022 07:28

Hi Niko,

Please accept my apologies if the current behavior is giving you a hard time. I hope the provided workaround is feasible to use.

This is a confirmed issue (this is what "Unplanned" means) and its prioritization will depend on the severity and customer demand. On a side note, we plan several date/time UX improvements for early 2023.

Regards,
Dimo
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Niko
Posted on: 25 Oct 2022 10:52

I'm also facing thate Bug. It is a bit anoing because set the time by the picker, or even using the arrows on the keyboard only change the time as expected. Typing the time changes the date to now. 

@telerik Any plans to fix this?