vue 最近1个月 最近14天 上个月 当月

上图为效果

1.最近7天

   getSevenDays() {
      const currentDate = new Date();
      let startDate = new Date().setDate(currentDate.getDate() - 7);
      startDate = new Date(startDate);
      const endDate = new Date();
      return [startDate, endDate];
    }

2.最近14天

    getForDays() {
      const currentDate = new Date();
      let startDate = new Date().setDate(currentDate.getDate() - 14);
      startDate = new Date(startDate);
      const endDate = new Date();
      return [startDate, endDate];
    }

3.最近一个月

    getTdDays() {
      const currentDate = new Date

猜你喜欢

转载自blog.csdn.net/weixin_42066070/article/details/131051692