PDA

View Full Version : Weird behavior with Ext.DateField



Beginner1971
28 Mar 2012, 2:26 PM
The DateField control has some weird behavior. If you enter "12/32/2012", rather than give you an error message, it changes the date to "01/01/2013". If you enter "99/01/2012", it change the date to "03/01/2020". It's actually performing math on the number to create a brand new date.

Is there a way prevent this?

mitchellsimoens
29 Mar 2012, 8:24 AM
Set Date.useStrict:


Date.useStrict = true;

new Ext.form.FormPanel({
renderTo : document.body,
width : 400,
height : 400,
title : 'Test',
items : [
{
xtype : 'datefield',
fieldLabel : 'Date',
value : '12/32/2012'
}
]
});

Beginner1971
29 Mar 2012, 8:57 AM
Thanks!

wizhard
12 Apr 2012, 6:26 AM
Also thanks a lot from me!
You have taken me away from trouble... =D>