且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ExtJs datefield将无效日期转换为有效日期

更新时间:2021-12-15 06:49:48

如果日期字段的值不能使用配置的 格式 。这些格式可以使用 altFormats 属性。

There are alternative date formats which ExtJS will try to use if the datefield's value cannot be parsed using the configured format. These formats can be defined using the altFormats property.

默认值为:

m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d

这解释了为什么像 21/17 之类的东西被转换为 9/17/2015 ,作为格式 m / d 在这里(2014年的第21个月真的是2015年第9期)。

which explains why something like 21/17 gets converted to 9/17/2015, as the format m/d is used here (the "21st" month of 2014 is really the 9th of 2015).

如果你想全部禁用,只需将该属性设置为一个空字符串:

If you want to disable this altogether, just set the property to an empty string:

altFormats: ''