Date format issue

4 posts, 0 answers
  1. Simon
    Simon avatar
    4 posts
    Member since:
    Sep 2014

    Posted 18 Apr Link to this post

    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.

  2. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 21 Apr Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Simon
    Simon avatar
    4 posts
    Member since:
    Sep 2014

    Posted 28 Apr in reply to Alex Gyoshev Link to this post

    Writing an update from Alex Gyoshev... The bug with Internationalisation and the date formats willbe fixed in 2016.Q2 release.
  5. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 29 Apr Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready