根据月份获取整月日期

   let month = value.month.split('-'); // value 2020-1
    let paramsStartTime = '';
    let paramsEndTime = '';
    paramsStartTime = month[0] + '-' + month[1] + '-01';
    const tempDate = new Date(paramsStartTime);
    tempDate.setMonth((tempDate.getMonth() + 1));
    tempDate.setDate(tempDate.getDate() - 1);
    paramsEndTime = `${tempDate.getFullYear()}-${(tempDate.getMonth() + 1).toString()
      .padStart(2, '0')}-${tempDate.getDate()
        .toString()
        .padStart(2, '0')}`;

 

posted @ 2022-09-08 17:49  宇智波copy  阅读(38)  评论(0编辑  收藏  举报