Timepicker always displays midnight on blur

1 Answer 261 Views
Date/Time Pickers
Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
Lee asked on 09 Nov 2021, 06:37 PM | edited on 09 Nov 2021, 06:38 PM

I am having an issue where when I select a different time from the timepicker it is reverting back to zero. I have created a dojo with 2 timepickers. Both are initiated in a loop and stored in an object with the key being the id of the input. My issue is that if I set dateInput to true the time reverts back to midnight on blur. When I console.log the value though it is the value I picked. This is only an issue on the timepicker that has the min and max options set. I need the user to be able to input a time using the datepicker formatting and only choose from select times. 

Dojo:

https://dojo.telerik.com/@dojolee/UQuBiNoV

 

1 Answer, 1 is accepted

Sort by
0
Georgi Denchev
Telerik team
answered on 12 Nov 2021, 09:06 AM

Hi, Lee,

Thank you for the provided Dojo.

You need to update the min/max configurations of the dateInput as well:

  timePickers["reviewScheduledStartTime"]._dateInput.setOptions({
      	min: new Date(2000, 0, 1, 8, 0, 0),
        max: new Date(2000, 0, 1, 23, 0, 0)
    });

Modified Dojo:

https://dojo.telerik.com/@gdenchev/EBOyaQeD 

Let me know if you have any questions.

Best Regards,
Georgi Denchev
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/.

Alexa
Top achievements
Rank 1
commented on 14 Dec 2023, 09:07 PM

Hi Georgi,

Does Kendo consider properties named with a leading underscore to be "private"? Or in other words, are they not intended to be used directly? My concern with the solution proposed above is on future updates _dateInput will not be available or will work differently, but the changelog may not mention changes to "internal" properties.

I looked in the Timepicker docs and API but didn't see anything about _dateInput. I just found that DateInput is a widget itself and can be integrated into timepickers via the dateInput (boolean) option. Please let me know if I did miss some documentation. 

I ran into the same problem and will use the proposed solution for now; I just ask because I have run into some hard-to-track bugs using internal properties from other libraries when they were updated. :) 

Thanks,

-Alexa

Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
commented on 14 Dec 2023, 09:55 PM

I agree with Alexa. This is working for me right now but seems very sketchy and is a pain to have to do everywhere in the code. I'm running into a similar issue with the placeholder text "mm/dd/yyyy" or "hh:mm" in date and time pickers where I have to use the _dateInput.setOptions. 
Georgi Denchev
Telerik team
commented on 19 Dec 2023, 08:41 AM

Hi, Alexa and Lee,

Yes, properties that start with _ are deemed as private. The DatePickers are a bit more unique as they integrate a secondary component when a particular setting is enabled.

At the moment, the only properties of the dateinput that can be modified through a parent component's configuration are the messages:

https://docs.telerik.com/kendo-ui/api/javascript/ui/timepicker/configuration/messages.dateinput 

Nevertheless, allowing other DateInput options to be set through the parent widget seems like a valid idea to me. I'd recommend opening a Feature Request in our portal as this helps us keep track of the demand for particular features.

Best Regards,

Georgi

Tags
Date/Time Pickers
Asked by
Lee
Top achievements
Rank 2
Bronze
Bronze
Bronze
Answers by
Georgi Denchev
Telerik team
Share this question
or