PDA

View Full Version : Timepicker field with non-English locale not accepting its own values



oren.s
19 Apr 2012, 3:48 AM
As an example, I used a Japaneses locale, but I think it's a problem with many others.

My application has a timepicker, and it works great with English locale. When I change the locale to Japanese, dates and times are formatted correctly, as far as I can see. For example, take this line of code:


Ext.Date.format(new Date(), Ext.form.field.Time.prototype.format)


It returns the current time of the day, in the format of the current locale. If no format is defined for the locale, it uses a default. For English it may return "2:23 PM", and for Japanese "2:23 午後".

However, the timepicker validation fails for any value. As far as I can see it fails to parse its own formatted text as a valid time.

I took a look at the Japanese file 'ext-lang-ja.js', and saw the format is identical to the English format: 'g:i A', so as I understand the parsing of a Japanese-locale time is wrong, failing to recognize "午後" ("PM"). See the following line of code which formats a Date object and the parses the resulting String back to a Date, using the same format. It works (returns a Date) in English locale, and fails in Japanese locale.


Ext.Date.parse(

Ext.Date.format(new Date(), Ext.form.field.Time.prototype.format),
Ext.form.field.Time.prototype.format

)
I can override the locale, so it's possible to just not display and accept strings in many languages, which I intend to do for any unrecognized or 'unsupported' locale, but I want to resolve this for common languages. The point here is that a Japanese-specific solution is acceptable -- I'll just reproduce for the other languages I want to support.

Thanks.

scottmartin
19 Apr 2012, 5:38 AM
This will be corrected for the final release. Many issues have been addressed in regards to locale.

Regards,
Scott.

oren.s
10 May 2012, 10:23 AM
This will be corrected for the final release. Many issues have been addressed in regards to locale.

Regards,
Scott.

After migrating to the final 4.1.0 release, the problem is not resolved.

I'll appreciate any suggestion for a workaround or a patch.
Also, if someone knows how to change the thread to 'unanswered', let me know...

scottmartin
10 May 2012, 11:10 AM
I have reset the answer. If you can create a working example using the following template, we can issue a bug fix for your case:
http://www.sencha.com/forum/showthread.php?138165

Regards,
Scott.