let currentDate = new Date()
let currentWeek = currentDate.getDay()
if (currentWeek === 5) {
// currentDate 就是这个星期五的日期
console.log('今天周五')
this.isWeekFri = true
} else if (currentWeek === 6) {
let timestamp = currentDate.getTime() - 1 * 24 * 60 * 60 * 1000 * 1
currentDate = new Date(timestamp) // currentDate 就是这个星期五的日期
console.log('这个星期五的日期',currentDate)
this.isWeekFri = false
} else {
let timestamp = currentDate.getTime() - 1 * 24 * 60 * 60 * 1000 * (currentWeek + 2)
currentDate = new Date(timestamp) // currentDate(如果是0就是这个星期五日期,否则就是上一个星期五日期)
console.log('上一个星期五日期',currentDate)
this.isWeekFri = false
}
06-10
651
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
03-14
9013
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)