Yaniv
Yaniv

Reputation: 1908

Ext.js Date Format Locale

I put the format to be (M d, Y) where I want it to be "Nov 20, 2013" works great in English.

The problem is - when I use different locale on the page, it does direct translation and not change the format to a format that is used in that location, for example, when I use Chinese it just transalte the word November. and not change the structure of the date.

any suggestion what can I do to overcome this issue?

Upvotes: 1

Views: 3107

Answers (1)

matt
matt

Reputation: 4047

If you're providing your own date format (e.g. for a date field) then this format will be used, no matter if it is appropriate for the current location or not.

Assuming you're using a locale file ext-lang-*.js, you can use the property Ext.Date.defaultFormat, which will contain the format code of that locale.

Alternatively, you can also set the value of that property yourself:

Ext.Date.defaultFormat = 'Y-m-d'; // your format here

EDIT: I just had a look the chinese language files and it seems that they do not set a defaultFormat, so you will have to set it yourself (as described above).

Upvotes: 1

Related Questions