今天
const startTime = moment(moment().startOf('day').valueOf()).format('YYYY/MM/DD HH:mm:ss');
const endTime = moment(moment().valueOf()).format('YYYY/MM/DD HH:mm:ss');
昨天
const startTime = moment(moment().add(-1, 'days').startOf('day').valueOf()).format('YYYY/MM/DD HH:mm:ss');
const endTime = moment(moment().add(-1, 'days').endOf('day').valueOf()).format('YYYY/MM/DD HH:mm:ss')
本周
const startTime = moment(moment().week(moment().week()).startOf('week').valueOf()).format('YYYY/MM/DD HH:mm:ss');
const endTime = moment(moment().week(moment().week()).endOf('week').valueOf()).format('YYYY/MM/DD HH:mm:ss');
上周
const startTime = moment(moment().week(moment().week() - 1).startOf('week').valueOf()).format('YYYY/MM/DD HH:mm:ss');
const endTime = moment(moment().week(moment().week() - 1).endOf('week').valueOf()).format('YYYY/MM/DD HH:mm:ss')
本月
const startTime = moment(moment().month(moment().month()).startOf('month').valueOf()).format('YYYY/MM/DD HH:mm:ss');
const endTime = moment(moment().month(moment().month()).endOf('month').valueOf()).format('YYYY/MM/DD HH:mm:ss')
上月
const startTime = moment(moment().month(moment().month() - 1).startOf('month').valueOf()).format('YYYY/MM/DD HH:mm:ss');
const endTime = moment(moment().month(moment().month() - 1).endOf('month').valueOf()).format('YYYY/MM/DD HH:mm:ss');
本季度
const startTime = moment(moment().quarter(moment().quarter()).startOf('quarter').valueOf()).format('YYYY/MM/DD HH:mm:ss');
const endTime = moment(moment().quarter(moment().quarter()).endOf('quarter').valueOf()).format('YYYY/MM/DD HH:mm:ss');
上季度
const startTime = moment(moment().quarter(moment().quarter() - 1).startOf('quarter').valueOf()).format('YYYY/MM/DD HH:mm:ss');
const endTime = moment(moment().quarter(moment().quarter() - 1).endOf('quarter').valueOf()).format('YYYY/MM/DD HH:mm:ss');
本年
const startTime = moment(moment().year(moment().year()).startOf('year').valueOf()).format('YYYY/MM/DD HH:mm:ss');
const endTime = moment(moment().year(moment().year()).endOf('year').valueOf()).format('YYYY/MM/DD HH:mm:ss');
上年
const startTime = moment(moment().year(moment().year() - 1).startOf('year').valueOf()).format('YYYY/MM/DD HH:mm:ss');
const endTime = moment(moment().year(moment().year() - 1).endOf('year').valueOf()).format('YYYY/MM/DD HH:mm:ss');
某一时间所在的周一和周日
const weekOfday: any = moment(filtrateForm.date, 'YYYY-MM-DD').format('E') //计算指定日期是这周第几天
const startDate = moment(filtrateForm.date)
.subtract(weekOfday - 1, 'days')
.format('YYYY-MM-DD') //周一日期
const endDate = moment(filtrateForm.date)
.add(7 - weekOfday, 'days')
.format('YYYY-MM-DD') //周日日期
某一时间所在的月初和月末
const startWeekDay = moment(monthDate.value)
.month(moment(monthDate.value).month())
.startOf('month')
.format('YYYY-MM-DD')
const endWeekDay = moment(monthDate.value)
.month(moment(monthDate.value).month())
.endOf('month')
.format('YYYY-MM-DD')
monthDay.value = [startWeekDay, endWeekDay]