KendoUI TimePickerFor

2 posts, 0 answers
  1. Shawn
    Shawn avatar
    1 posts
    Member since:
    Oct 2016

    Posted 17 May Link to this post

    I'm having a strange problem (it didn't happen before and all of a sudden started happening) with the Kendo().TimePickerFor().

     

    I have an ASP MVC application and I'm passing a model with start and end times to the Kendo().TimePickerFor() like this:

    <div>
                       @Html.LabelFor(model => model.StartTime)
                       @(Html.Kendo().TimePickerFor(model => model.StartTime).Events(e => e.Change("startChange"));
    </div>
    <div>

           @Html.LabelFor(model => model.EndTime)
           @Html.Kendo().TimePickerFor(model => model.EndTime);
    </div>

     

    Using the chrome debugger; I get this error:

     

    The specified value "8:00 AM" does not conform to the required format.  The format is "HH:mm", "HH:mm:ss" or "HH:mm:ss.SSS" where HH is 00-23, mm is 00-59, ss is 00-59, and SSS is 000-999.

     

     

    So I thought, OK, just a formatting issue. So I did this:

     

       <div>
                       @Html.LabelFor(model => model.StartTime)
                       @(Html.Kendo().TimePickerFor(model => model.StartTime)
            .Events(e => e.Change("startChange")).Format("hh:mm"));
                                    </div>

     

    But this changes it to military time; and I no longer have the AM/PM option.

     

    So I did this:

       <div>
                       @Html.LabelFor(model => model.StartTime)
                       @(Html.Kendo().TimePickerFor(model => model.StartTime)
            .Events(e => e.Change("startChange")).Format("hh:mm"));
                                    </div>

     

    and I get the original error as above on the chrome debugger: 

    The specified value "8:00 AM" does not conform to the required format.  The format is "HH:mm", "HH:mm:ss" or "HH:mm:ss.SSS" where HH is 00-23, mm is 00-59, ss is 00-59, and SSS is 000-999.

     

     

    How do I pass the date and keep the am/pm format?

     

     

     

     

     

  2. Georgi
    Admin
    Georgi avatar
    59 posts

    Posted 19 May Link to this post

    Hi Shawn,

    I replicated your situation and it works as expected on my end. Please send me the project or a sample where the error appears so I can investigate locally your exact scenario and help you more efficiently.

    Regards,
    Georgi
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top