Date转字符串
let now = new Date()
now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDate()
Date转时间戳
// 将Date转为数字类型即可
new Date()*1
字符串转Date
// str 为字符串格式,例如: 2019-10-9
new Date(str)
组合用法,距今几天
parseInt((new Date(str) * 1 - new Date() * 1)/86400000 )
当前时间加几天
// day 为天数
let now = new Date()
now.setDate(now.getDate() + parseInt(day))