1. //获取本日
    2. const startDate = moment().format('YYYY-MM-DD');
    3. const startDate = moment().format('YYYY-MM-DD');
    4. //获取本周
    5. //这样是年月日的格式
    6. const startDate = moment().week(moment().week()).startOf('week').format('YYYY-MM-DD');
    7. //这样是时间戳的格式
    8. const endDate = moment().week(moment().week()).endOf('week').valueOf();
    9. //获取本月
    10. const startDate = moment().month(moment().month()).startOf('month').valueOf();
    11. const endDate = moment().month(moment().month()).endOf('month').valueOf();
    12. //获取本年
    13. const startDate = moment().year(moment().year()).startOf('year').valueOf();
    14. const endDate = moment().year(moment().year()).endOf('year').valueOf();