-
16 May 2012 10:21 PM #1
Timefield with Japanese locale does not accept its own values
Timefield with Japanese locale does not accept its own values
REQUIRED INFORMATION
Ext version tested:- Ext 4.1.0 rev release
- Chrome 18/19
- FF 10
- html
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:- Use Japanese locale to view a simple timefield; OR...
- Run the test case code in a JS console with Japanese locale.
- [viewing a timefield] Inputs are valid.
- [running test case] The last line returns a JS Date object.
- [viewing a timefield] Inputs are invalid.
- [running test case] The last line returns undefined.
Code:var format = Ext.form.field.Time.prototype.format; var = Ext.Date.format( new Date(), format ); Ext.Date.parse( formattedDateString, format );
Operating System:- Win7
-
25 May 2012 1:04 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
The locale files are in dire need of repair and we are working to correct them.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
27 Nov 2012 3:07 PM #3
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.
This snippet should be just below this code: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;
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.Code:Ext.Date.formatCodes.a = "(this.getHours() < 12 ? '午前' : '午後')"; Ext.Date.formatCodes.A = "(this.getHours() < 12 ? '午前' : '午後')"; // no case difference
Note that this change was done in ExtJS 4.1.1
Due to the impact related to this issue, we have to defer this issue to the next major or minor release.


Reply With Quote