用JS獲取當前時間和之後幾天的時間
handleTime(day) {
console.log(new Date(new Date().setDate(new Date().getDate() + Number(day))).toJSON())
return new Date(new Date().setDate(new Date().getDate() + Number(day))).toJSON().split('T')[0]
},
![打印的結果](https://img-blog.csdnimg.cn/20190529165441725.png)
new Date(new Date().setMonth(new Date().getMonth() - 1)).toJSON().split('T')[0] // 獲取前一個月的時間
export const GET_NOW_TIME = new Date().toJSON().split('T')[0] // 獲取當前時間