View Full Version : [CLOSED] DateField with date format 'Y-n-d A g:i' does not honor change from AM to PM

6 Oct 2010, 8:09 AM
Dear reader

I have a DateField that uses following format 'Y-n-d A g:i':
Ext.onReady( function() {
var testDate = new Ext.form.DateField( {
id: 'startDate',
renderTo: 'startDate_container'
allowBlank: false,
format: 'Y-n-d A g:i',
value: new Date(1286378100000) }); }); The html has <div id="startDate_container"></div> where the field is placed

The value in the field is shown as '2010-10-06 AM 11:15'.
1) If 'AM' is changed to 'PM' it goes back to 'AM' on blur
2) If 'AM 11' is changed to 'AM 23' it goes to 'PM 11' after blur
This is inconsistent and leads to the loss of the input

The function beforeBlur seems to be the one there this happens.
For 1) while raw value is '2010-10-06 PM 11:15', the date equivalent returned from parseDate is 'Wed Oct 06 2010 11:15:00 GMT-0400 (Eastern Daylight Time)'
For 2) while raw value '2010-10-06 PM 23:15' is not flagged as invalid input as it should, the date equivalent returned from parseDate is 'Wed Oct 06 2010 23:15:00 GMT-0400 (Eastern Daylight Time)'. After the value is set it is shown as '2010-10-06 PM 11:15'.

Thanks a lot and please please solve this bug

14 Oct 2010, 4:13 PM
Hi Irena,

I'm not able to reproduce #1 above with the latest SVN (7245) release.
Number 2 is the desired behavior in Ext JS.


14 Oct 2010, 4:17 PM
FYI It was logged as a support ticket and was since fixed in SVN. Very obscure one ;)