PDA

View Full Version : Issue with 'Ext.form.dateField'.



arian10daddy
22 Jul 2010, 10:11 AM
Hi All,

I'm having an issue with dateField being used in my application.

When I try to set a value into the date field, it sets fine in firefox, but not in IE8.

Here is the code for my dateField:


var holidayDate = new Ext.form.DateField({
id:"holidayDate",
name:"holidayDate",
fieldLabel:"Date",
allowBlank: false,
format: 'Y-m-d',
style:'border:0',
minValue: new Date()
});and this is how I set the value:

var selectedDate = "2010-06-27";
Ext.getCmp('holidayDate').setValue(new Date(selectedDate));Does anyone have any idea why this could be happening?

Thanks in advance for the reply.

mankz
22 Jul 2010, 11:03 AM
Your issue is because the way different browsers handle dates (don't pass strings to the Date constructor):



Ext.getCmp('holidayDate').setValue(new Date(2010, 05, 27)); // Months are zero based