其他分享
首页 > 其他分享> > 根据年和周数,返回这周起止时间

根据年和周数,返回这周起止时间

作者:互联网

 // 返回星期一和星期日     getWeekRange(yearNo: number, weekNo: number): any {       let firstDayofYear = new Date(yearNo, 0, 1);       if (firstDayofYear.getDay() > 4)  {           let weekStart = new Date(yearNo, 0, 1 + (weekNo - 1) * 7 - firstDayofYear.getDay() + 8);           let weekEnd = new Date(yearNo, 0, 1 + (weekNo - 1) * 7 - firstDayofYear.getDay() + 8 + 6);           return { startDay: this.dateFormatter(weekStart), endDay: this.dateFormatter(weekEnd) };       }       else {           let weekStart = new Date(yearNo, 0, 1 + (weekNo - 1) * 7 - firstDayofYear.getDay() + 1);           let weekEnd = new Date(yearNo, 0, 1 + (weekNo - 1) * 7 - firstDayofYear.getDay() + 1 + 6);           return { startDay: weekStart, endDay: weekEnd };       }   }

标签:返回,firstDayofYear,起止,周数,yearNo,weekNo,getDay,Date,new
来源: https://www.cnblogs.com/gaosj20210301/p/16502553.html