Select time other than interval time

2 posts, 0 answers
  1. Partha
    Partha avatar
    2 posts
    Member since:
    Jul 2012

    Posted 27 Aug 2015 Link to this post

    Dear Kendo UI Team,

     I'm using Kendo ui datetimepicker where I've set interval as 15.

    As, interval is 15 if I open up time picker icon then it displays 12:00 AM, 12:15 AM ... 11:45 PM which is correct.

    Now, my question is if I manually save time as 02:17 PM then while editing when I click on time picker icon I want automatically set time as 2:15 PM or 2:30 PM, how can I achieve this? If time is part of interval then it automatically selects but if not then in that case how can I make it possible?

    Waiting for your answer, many thanks.

     

     

  2. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 28 Aug 2015 Link to this post

    Hello Hemanth,

    There is no built-in option to achieve such an automatic value change. By design, such manipulation of the value assigned is not recommended behavior for an UI component.

    However, as a custom solution, you can use the widget's events to detect the opening of the Time Popup (http://docs.telerik.com/KENDO-UI/api/javascript/ui/datetimepicker#events-open), parse the currently selected value, round it via JS approach (this Stackoverflow thread would be useful—http://stackoverflow.com/questions/4968250/how-to-round-time-to-the-nearest-quarter-hour-in-javascript) and finally, assign the result from the round operation to the DateTime input  (http://docs.telerik.com/KENDO-UI/api/javascript/ui/datetimepicker#methods-value).

    Regards,
    Ianko
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top