View Full Version : [REOPENED] Datepicker not resolving dates with ext-lang-de (german language file)

28 Nov 2007, 7:02 AM
The regex issue is solved at http://extjs.com/forum/showthread.php?t=19394

Hi everyone,

This is odd. Ive just included /ext/source/locale/ext-lang-de.js to my Ext App to get german date names in Ext.DatePicker. All strings are showing up fine, but whenever I try to insert a date by direct input instead of picking the date via the DatePicker, I receive 01. Januar 1970 as the date. Im using the datepicker from a datefield.

fieldLabel: OC.locale.labels.dob,
name: 'dob',
xtype: 'datefield',
format: 'd. F Y',
altFormats: 'd/m/y|d/m/Y|d-m-y|d-m-Y|d.m.y|d.m.Y|j.n.y|j.n.Y|j n Y|j n y|d m y|d m Y'

When I remove the language file, I can input dates as specified in the pickers altFormats and the dates get resolved accordingly.

is this the correct way to include the lang file? Its all in the head element

<link rel="stylesheet" type="text/css" media="screen" href="/ext/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/stylesheets/app.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/stylesheets/icons.css" />
<script type="text/javascript" src="/ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="/ext/ext-all.js"></script>
<script type="text/javascript" src="/ext/source/locale/ext-lang-de.js"></script>
<script type="text/javascript" src="/javascripts/shared.js"></script>
<script type="text/javascript" src="/javascripts/locale.de_DE.js"></script>
<script type="text/javascript" src="/javascripts/myapp.js"></script>

The other locale doesnt interfere with the ext lang file. It only holds strings that specific to my application.

Ive searched the forum, but couldnt find anything about the picker or the lang file being broken and I dont know how to debug this. Could anyone give me a hint?


28 Nov 2007, 7:55 AM
In the german locale file the date separator is a period (.). As a result the Date.parseDate function will create a regular expresson for the date format with unescaped periods (which has special meaning in a RegExp!).

Unfortunately escaping the periods (e.g. \.) doesn't work because ExtJS will uses String.escape to add the period to the RegExp (and String.escape doesn't escape periods!).

I'll report this in the bug section.