Results 1 to 3 of 3

Thread: Timefield with Japanese locale does not accept its own values

    Due to the impact related to this issue, we have to defer this issue to the next major or minor release.
  1. #1
    Ext GWT Premium Member
    Join Date
    Aug 2011
    Posts
    7
    Vote Rating
    1
      0  

    Default Timefield with Japanese locale does not accept its own values

    REQUIRED INFORMATION

    Ext version tested:

    • Ext 4.1.0 rev release
    Browser versions tested against:
    • Chrome 18/19
    • FF 10
    DOCTYPE tested against:
    • html
    Description:
    Timefield with some non-English locales, such as Japanese, does not accept its own values: the field formats times according to the locale but fails to parse the resulting strings, and as a result mark the string as invalid input.

    As far as I can see, the root cause has to do with Ext.Date's parse method, see test case below.
    Also see this Q&A thread, where I discussed the issue with scottmartin in more detail, but I think this description and the test case provide the relevant information. I found this issue a month ago and was told it will be fixed in the stable release. Since that did not happen, I will very much appreciate if you could give the issue higher priority.

    Steps to reproduce the problem:
    1. Use Japanese locale to view a simple timefield; OR...
    2. Run the test case code in a JS console with Japanese locale.
    The result that was expected:
    1. [viewing a timefield] Inputs are valid.
    2. [running test case] The last line returns a JS Date object.
    The result that occurs instead:
    1. [viewing a timefield] Inputs are invalid.
    2. [running test case] The last line returns undefined.
    Test Case:
    Code:
    var format = Ext.form.field.Time.prototype.format;
    var = Ext.Date.format( new Date(), format );
    Ext.Date.parse( formattedDateString, format );

    Operating System:
    • Win7

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    The locale files are in dire need of repair and we are working to correct them.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    1
    Vote Rating
    0
      0  

    Default

    I took a look at the ext-lang-zh_CN.js file since the timefield validation was working correctly in Chinese. I found that adding this snippet to the ext-lang-ja.js file fixed the timefield validation problem for me. This snippet is similar to what was in the ext-lang-zh_CN.js file.

    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;
    This snippet should be just below this code:

    Code:
    Ext.Date.formatCodes.a = "(this.getHours() < 12 ? '??' : '??')";
    Ext.Date.formatCodes.A = "(this.getHours() < 12 ? '??' : '??')"; // no case difference
    If this is all that needs to be changed I don't believe this fix should of been deferred to the next major or minor release.

    Note that this change was done in ExtJS 4.1.1

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
  •