<script language="javascript">
//限制开始和结束时间为同一个月
function limitMonthDate(e) {
var DateString;
if (e == 2) {
var beginDate = $dp.$("beginTime").value;
if (beginDate != "" && beginDate != null) {
var limitDate = new Date(beginDate);
limitDate.setDate(new Date(limitDate.getFullYear(), limitDate
.getMonth() + 1, 0).getDate()); //获取此月份的天数
DateString = limitDate.getFullYear() + '-'
+ (limitDate.getMonth() + 1) + '-'
+ limitDate.getDate();
return DateString;
}
}
if (e == 1) {
var endDate = $dp.$("endTime").value;
if (endDate != "" && endDate != null) {
var limitDate = new Date(endDate);
limitDate.setDate("1"); //设置闲置时间为月初
DateString = limitDate.getFullYear() + '-'
+ (limitDate.getMonth() + 1) + '-'
+ limitDate.getDate();
return DateString;
}
}
}
</script>
上文是同一个月的,可以稍微改一下代码,帮助文档参考日期控件查询天数控制-https://help.fanruan.com/finereport/doc-view-3060.html