This is a migrated thread and some comments may be shown as answers.

Unsupported date formats in DatePicker

4 Answers 789 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Nishad
Top achievements
Rank 1
Nishad asked on 20 Feb 2013, 06:34 AM

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

4 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 21 Feb 2013, 12:00 PM
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!
0
Mike
Top achievements
Rank 1
answered on 21 May 2013, 02:27 PM
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
0
Kamal
Top achievements
Rank 1
answered on 04 Apr 2016, 06:27 PM

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?

0
Georgi Krustev
Telerik team
answered on 06 Apr 2016, 09:09 AM

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!
 
Tags
Date/Time Pickers
Asked by
Nishad
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Mike
Top achievements
Rank 1
Kamal
Top achievements
Rank 1
Share this question
or