Results 1 to 3 of 3

Thread: Ext.Date fails to parse Japanese datetime in 24-hr format

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-7511 in 4.1.4.
  1. #1
    Ext JS Premium Member
    Join Date
    Sep 2011
    Posts
    4

    Lightbulb Ext.Date fails to parse Japanese datetime in 24-hr format

    Ext.Date fails to parse Japanese datetime in 24-hr format. The following statement fails to parse the date and returns undefined.

    Code:
    Ext.Date.parse('1969/12/31 ??04?00?','Y/m/d Ah?i?');
    After debugging through the code, I found that Ext.Date.parseCodes.a and Ext.Date.parseCodes.A are missing.

    The following is the fix that should go into ext-lang-ja.js

    Code:
    parseCodes = {
                g: 1,
                c: "if (/(??)/i.test(results[{0}])) {\n"
                    + "if (!h || h == 12) { h = 0; }\n"
                    + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
                s: "(??|??)",
                calcAtEnd: true
            };
      
     Ext.Date.parseCodes.a = Ext.Date.parseCodes.A = parseCodes

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Which version are you using? In the latest code it reads:

    Code:
    Ext.Date.formatCodes.a = "(this.getHours() < 12 ? '??' : '??')";
    Ext.Date.formatCodes.A = "(this.getHours() < 12 ? '??' : '??')"; // no case difference
            
    parseCodes = {
        g: 1,
        c: "if (/(??)/i.test(results[{0}])) {\n"
            + "if (!h || h == 12) { h = 0; }\n"
            + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
        s: "(??|??)",
        calcAtEnd: true
    };
    
    Ext.Date.parseCodes.a = Ext.Date.parseCodes.A = parseCodes;
    So it looks like the characters in the condition are incorrect? Is that right?

    Your code:
    Code:
    if(/??/....)
    Current code:
    Code:
    if (/??/...)
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Ext JS Premium Member
    Join Date
    Sep 2011
    Posts
    4

    Default

    I am using ExtJS 4.1.0.

    I don't know and can't read Chinese or Japanese. But it seems like ?? is Chinese for AM. And ??is for AM in Japanese. So, the if should have ??.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •