|
|
@@ -215,6 +215,7 @@ Component({
|
|
|
})
|
|
|
},
|
|
|
setTimeCycle(startdate = "", enddate = "") {
|
|
|
+ console.log(startdate,enddate)
|
|
|
if (typeof startdate == 'object') {
|
|
|
startdate = formatTime(startdate, '-').split(' ')[0]
|
|
|
}
|
|
|
@@ -245,9 +246,17 @@ Component({
|
|
|
const startOfMonth = new Date(date.getFullYear(), date.getMonth(), 1);
|
|
|
const endOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
|
endOfMonth.setHours(23, 59, 59, 999);
|
|
|
- console.log("startOfMonth", startOfMonth)
|
|
|
this.setTimeCycle(startOfMonth, endOfMonth)
|
|
|
},
|
|
|
+ //上月
|
|
|
+ getLastMonthRange(date = new Date()) {
|
|
|
+ const year = date.getFullYear();
|
|
|
+ const month = date.getMonth(); // Current month (0-based index)
|
|
|
+ const startOfLastMonth = new Date(year, month - 1, 1); // First day of last month
|
|
|
+ const endOfLastMonth = new Date(year, month, 0); // Last day of last month
|
|
|
+ endOfLastMonth.setHours(23, 59, 59, 999); // Set end time to the last millisecond of the day
|
|
|
+ this.setTimeCycle(startOfLastMonth, endOfLastMonth);
|
|
|
+ },
|
|
|
//本年
|
|
|
getYearRange(date = new Date()) {
|
|
|
const startOfYear = new Date(date.getFullYear(), 0, 1);
|