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

Date format issue

3 Answers 565 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 18 Apr 2016, 04:19 PM

I have an application where I'm gathering customer data via Kendo UI spreadsheet with DataSource. One of the fields is a DateOfBirth which I need to capture in en_GB format: dd/mm/yyyy. Please see this JsFiddle as an example: https://jsfiddle.net/s4c87msq/3/

Following are the issues:

1. If you enter text "01/03/1999" into any column - text or number or date, it gets parsed as en_US date (so the content of the cell changes to "03/01/1999"). How do I stop a texrt field being parsed as a date?

2. I'm having to set the DataSource schema DateOfBirth field type to "string" because if it is set to "Date" I get an error when kendo tried to parse it on change: TypeError: e.indexOf is not a function

Can you please refer to the JsFiddle and let me know how do I get the correct date from Spreadsheet in the dataSource?

Many thanks.

3 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 21 Apr 2016, 07:55 AM

Hello Simon,

1. This problem appears to be fixed in the latest service pack.
2. Dates in spreadsheet widgets are stored as numbers which indicate number of days since a base date (1/1/1900). If you need to store this field as a date on the server, you need to perform the date conversion via custom code.

See the updated (and reduced) jsFiddle snippet.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Chris
Top achievements
Rank 1
answered on 28 Apr 2016, 01:28 PM
Writing an update from Alex Gyoshev... The bug with Internationalisation and the date formats willbe fixed in 2016.Q2 release.
0
Alex Gyoshev
Telerik team
answered on 29 Apr 2016, 09:03 AM

Hello Simon,

 

The problem will be fixed in internal builds after the Q2 release.

Until it is fixed, the following code can be used to workaround the problem:

 

    kendo.spreadsheet.calc.runtime.parseDate = function parseDate(str) {
        return kendo.parseDate(str) || kendo.parseDate(str, [
            "MMMM dd yyyy",
            "MMMM dd yy",
            "MMM dd yyyy",
            "MMM dd yy",
            "dd MMMM yyyy",
            "dd MMMM yy",
            "dd MMM yyyy",
            "dd MMM yy",
            "MMMM dd, yyyy",
            "MMMM dd, yy",
            "MMM dd, yyyy",
            "MMM dd, yy",
            "MMMM dd",
            "MMM dd",
            "MMMM yyyy",
            "MMM yyyy",
            "dd MMMM",
            "dd MMM"
        ]);
    }

 

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Spreadsheet
Asked by
Chris
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Chris
Top achievements
Rank 1
Share this question
or