let date = new Date()
console.log(date)
let firstDay = new Date(date.getFullYear(), date.getMonth(), 1).toLocaleDateString().replace('/','-').replace('/','-');
let lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0).toLocaleDateString().replace('/','-').replace('/','-');
this.time=[firstDay,lastDay]
console.log(this.time)//["2020-12-1", "2020-12-31"]
获取到月初和月末日期
最新推荐文章于 2024-03-12 17:41:36 发布