给单据列表中的时间段增加默认值,默认3个月
This commit is contained in:
@@ -548,6 +548,24 @@ export function getBeforeFormatDate(day) {
|
||||
return thirtyDaysAgo.getFullYear() + seperator1 + month + seperator1 + strDate
|
||||
}
|
||||
|
||||
/**
|
||||
* js获取N月前的日期, 格式“yyyy-MM-dd”
|
||||
*/
|
||||
export function getPrevMonthFormatDate(monthNum) {
|
||||
let prevMonth = new Date(); // 当前日期
|
||||
prevMonth.setMonth(prevMonth.getMonth() - monthNum); // 设置为前一个月
|
||||
let seperator1 = "-";
|
||||
let month = prevMonth.getMonth() + 1;
|
||||
let strDate = prevMonth.getDate();
|
||||
if (month >= 1 && month <= 9) {
|
||||
month = "0" + month;
|
||||
}
|
||||
if (strDate >= 0 && strDate <= 9) {
|
||||
strDate = "0" + strDate;
|
||||
}
|
||||
return prevMonth.getFullYear() + seperator1 + month + seperator1 + strDate
|
||||
}
|
||||
|
||||
/**
|
||||
* JS中根据指定值删除数组中的元素
|
||||
* @param arrylist
|
||||
|
||||
Reference in New Issue
Block a user