Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Extjs中设置日期的最小值_Extjs_Extjs4_Extjs4.1_Extjs4.2_Extjs3 - Fatal编程技术网

在Extjs中设置日期的最小值

在Extjs中设置日期的最小值,extjs,extjs4,extjs4.1,extjs4.2,extjs3,Extjs,Extjs4,Extjs4.1,Extjs4.2,Extjs3,我正在使用以下代码: xtype: 'datefield', anchor: '100%', fieldLabel: 'From', name: 'from_date', minValue: new Date(2015, 2, 31) 我想将minValueconfig参数作为上个月的最后一天传递 其允许值显然可能是28、29、30或31 再怎么改月份 更清楚的是:如果我在4月份打开日期选择器,它会让我选择从3月31日到日历最后一天的值。您可以使用set config的方法,例如 minVla

我正在使用以下代码:

xtype: 'datefield',
anchor: '100%',
fieldLabel: 'From',
name: 'from_date',
minValue: new Date(2015, 2, 31)
我想将
minValue
config参数作为上个月的最后一天传递

其允许值显然可能是28、29、30或31

再怎么改月份

更清楚的是:如果我在4月份打开日期选择器,它会让我选择从3月31日到日历最后一天的值。

您可以使用set config的方法,例如

minVlaue = Ext.Date.getLastDateOfMonth(new Date(2015, 2, 31))

您可以通过以下方式解决此问题:

//you get the current date
currentDate = new Date();

//now get the first day of the current month
firstDayOfCurrMonth = Ext.Date.getFirstDateOfMonth(currentDate);

//Then subtract exactly one day
minValue = Ext.Date.subtract(firstDayOfCurrMonth, Ext.Date.DAY, 1);
实际上,
子域
方法:

提供执行基本日期算术的方便方法。此方法不修改正在调用的日期实例-它创建并返回一个包含结果日期值的新日期实例


需要上个月的最后日期。。更清楚地说。。。如果我在四月打开日期选择器。。。它让我可以选择从3月31日到日历最后一天的值。我想投票否决它,但没有125个声誉。祝你好运,你很快就能赢得125个声誉,不管怎么说,关于你的问题-你只需要找出如何传递一个可变日期(前几个月的日期)作为getLastDateOfMonth函数的参数。。。