Reputation: 1079
I am trying to default the value of a textfield to the first of the current month
{
xtype:"textfield",
fieldLabel:"Effective Date",
name:"effDate",
labelAlign:"top",
editable:false,
value: Ext.Date.getFirstDateOfMonth()//throws error saying cannot read property "getFullYear" of undefined
}
Upvotes: 0
Views: 153
Reputation: 4760
If you are trying to get the first date of the current month, you should add new Date() as a parameter.
{
xtype:"textfield",
fieldLabel:"Effective Date",
name:"effDate",
labelAlign:"top",
editable:false,
value: Ext.Date.getFirstDateOfMonth(new Date())
}
Upvotes: 1
Reputation: 2496
You must pass date to this function
value: Ext.Date.getFirstDateOfMonth(new Date()) // for example
Upvotes: 2