|
@@ -161,9 +161,18 @@ export const seltYearAndNowLast = [
|
|
|
{
|
|
|
text: '上一个月',
|
|
|
value: (() => {
|
|
|
- const start = moment(moment().month(moment().month() - 1).startOf('month').valueOf()).format('YYYY-MM-DD');
|
|
|
- const end = moment(moment().month(moment().month() - 1).endOf('month').valueOf()).format('YYYY-MM-DD');
|
|
|
- return [start, end]
|
|
|
+ const nowDate = new Date()
|
|
|
+ const month = nowDate.getMonth()
|
|
|
+ // 如果是现在1月份,就取现在1月份的时间,否则取上一个月的时间
|
|
|
+ if (month === 1) {
|
|
|
+ const start = nowDate.getFullYear() + "-01-01";
|
|
|
+ const end = nowDate.getFullYear() + "-01-31";
|
|
|
+ return [start, end]
|
|
|
+ } else {
|
|
|
+ const start = moment(moment().month(moment().month() - 1).startOf('month').valueOf()).format('YYYY-MM-DD');
|
|
|
+ const end = moment(moment().month(moment().month() - 1).endOf('month').valueOf()).format('YYYY-MM-DD');
|
|
|
+ return [start, end]
|
|
|
+ }
|
|
|
})(),
|
|
|
},
|
|
|
]
|