//获取本日const startDate = moment().format('YYYY-MM-DD'); const startDate = moment().format('YYYY-MM-DD');//获取本周//这样是年月日的格式const startDate = moment().week(moment().week()).startOf('week').format('YYYY-MM-DD');//这样是时间戳的格式const endDate = moment().week(moment().week()).endOf('week').valueOf(); //获取本月 const startDate = moment().month(moment().month()).startOf('month').valueOf();const endDate = moment().month(moment().month()).endOf('month').valueOf();//获取本年const startDate = moment().year(moment().year()).startOf('year').valueOf();const endDate = moment().year(moment().year()).endOf('year').valueOf();