Date format error with date picker

2 posts, 0 answers
  1. Raja
    Raja avatar
    43 posts
    Member since:
    Oct 2013

    Posted 30 Jun 2015 Link to this post

    I am getting a warning in the browser console (Chrome) with kendo date picker.


    I am not setting date format to "yyyy-MM-dd". I have even tried to set up date format in the cshtml page for the kendo date picker.

    @(Html.Kendo().DatePickerFor(m => m.StartDate)

    Is this a default date format with date pciker? How can I change it?

  2. Georgi Krustev
    Georgi Krustev avatar
    3687 posts

    Posted 02 Jul 2015 Link to this post

    Hello Raja,

    The described warning is due the validation that Chrome performs. It does allow only one specific format / value *yyyy-MM-dd" to put in when the input is of type "date". In general, we generate an input element with type "date" and then on the client we change it to type="text" in order to allow different formatted values (e.g. MM/dd/yyyy).

    If you would like to avoid the warnings, just set the type of the input explicitly to "text":
    @(Html.Kendo().DatePickerFor(m => m.StartDate)
               .HtmlAttributes(new { type = "text" })

    The side effect of this action is that the input will not be of date type if JavaScript is disabled (graceful degradation).

    Georgi Krustev
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET AJAX banner
Back to Top