function getPreDate () {
const toDate = new Date()
const preDay = toDate - 24 * 60 * 60 * 1000
const preDate = new Date(preDay)
return `${preDate.getFullYear()}-${(preDate.getMonth() + 1) > 9 ? preDate.getMonth() + 1 : '0' + (preDate.getMonth() + 1)}-${(preDate.getDate()) > 9 ? preDate.getDate() : '0' + (preDate.getDate())}`
}
网友评论