Unsupported date formats in DatePicker

5 posts, 0 answers
  1. Nishad
    Nishad avatar
    2 posts
    Member since:
    Jun 2012

    Posted 20 Feb 2013 Link to this post


    I have requirement where application has to support the following formats, but DatePicker is not supporting the formats.

    $("#sampleDate").kendoDatePicker({
        format: "MM/dd/yyyy",
        parseFormats: ["Mddyyyy", "Mddyy", "MM/dd/00y", "MM/d/00y", "M/dd/00y", "M/d/00y"]
    });

    Can someone help with this!

    Thanks,
    Nishad

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 21 Feb 2013 Link to this post

    Hello Nishad,

     
    Strings which are formatted like "Mddyyyy" are really hard to parse and currently are not supported by kendo.parseDate. Nevertheless dates, like "MMddyyyy" are fully supported. 
    Parsing formats, like "Mddyyyy", which merge months and days are hard to be parsed correctly and currently are not supported. Nevertheless, I believe that other formats are supported. Please note that "0" is not valid specifier.

    Regards,
    Georgi Krustev
    the Telerik team
    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
  4. Mike
    Mike avatar
    12 posts
    Member since:
    Apr 2013

    Posted 21 May 2013 Link to this post

    We have the same requirement.  I don't see why this would be difficult.  The format tells how to parse the string into a date format.  If you have:

    $("#sampleDate").kendoDatePicker({
        format: "MM/dd/yyyy",
        parseFormats: ["yy", "Mdy", "Mdyy", "Mddyy", "MMddyy", "Mddyyyy","MMddyyyy", "MM/dd/yyyy", "MM/d/yy", "M/dd/yy", "M/d/yy"]
    });​
    Then the strings get parsed as follows:
    12 uses "yy" and becomes 01/01/2012
    123 uses "Mdy" and becomes 01/02/2003
    1234 uses "Mdyy" and becomes 01/02/2034
    12345 uses "Mddyy" and becomes 01/23/2045
    121234 uses "MMddyy" and becomes 12/12/2034
    1232013 uses "Mddyyyy" and becomes 1/23/2013
    03122013 uses "MMddyyyy" and becomes 03/12/2013

    Thanks,
    Mike
  5. Kamal
    Kamal avatar
    3 posts
    Member since:
    Nov 2014

    Posted 04 Apr Link to this post

    Kendo Date picker,

    The following code should restrict the kendo datepicker to accept any format other than MM/dd/yyyy 

    $("#date").kendoDatePicker({
                format: "MM/dd/yyyy", parseFormats: ["MM/dd/yyyy"]
            }).data("kendoDatePicker");

     

    if user manually types yyyy/dd/MM format it gets converted into MM/dd/yyyy rather than kendo validator raising input validation error.

    Is there any setting on the kendodatepicker control which can raise invalid dateformat error?

  6. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 06 Apr Link to this post

    Hello Kamal,

    In general, the widget will not accept "yyyy/dd/MM" value as valid Date, when parseFormats has different format value. This Dojo demo proves that statement:

    -  http://dojo.telerik.com/orUGi

    Here is a screencast that I took during the test:

    -  http://screencast.com/t/s0uZO7xH2

    Could you let me know what I am missing something?

    Regards,

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