PDA

View Full Version : datefield formate error



koushlendr
7 Jan 2013, 2:27 AM
I have a date field in form, but I don't have any formate config but when i type 1/7/13 it give me below error msg.
1/7/13 is not a valid date - it must be in the format m/d/y. But if i check same code with sencha online it works without any issue. What I'm doing wrong ?



{
xtype : 'datefield',
fieldLabel : 'Effective Date',
name : 'effectiveDate'
}

scottmartin
7 Jan 2013, 3:29 PM
So the live API example here work as expected?
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.Date

Have you tried setting the format as shown in the Date Format Examples?

Do any formats work?

Scott.

koushlendr
7 Jan 2013, 7:42 PM
I don't want to define any format as i want to use default format(m/d/y) but default altFormate is getting overridden by local specific file (ext-lang-en.js)

Ref:
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.field.Date-cfg-altFormats (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.form.field.Date-cfg-altFormats)

ext-lang-en.js // Extjs file from Sencha
File has one override function to change the altFormats value for english user.

Ext.define("Ext.locale.en.form.field.Date", {
override: "Ext.form.field.Date",
disabledDaysText: "Disabled",
disabledDatesText: "Disabled",
minText: "The date in this field must be after {0}",
maxText: "The date in this field must be before {0}",
invalidText: "{0} is not a valid date - it must be in the format {1}",
format: "m/d/y",
altFormats: "m/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d" // different then default value
});

While using the default altFormats provided in the definition of datefield it works fine.
Why for english user default altformat is different ?