export function timestampToTime(timestamp) {
    const date = new Date(timestamp) //时间戳为10位需*1000，时间戳为13位的话不需乘1000
    const Y = date.getFullYear() + '-'
    const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
    const D = date.getDate() + ' '
    // const h = date.getHours() + ':'
    // const m = date.getMinutes() + ':'
    // const s = date.getSeconds()
    return Y + M + D
}

export function getThisDay(value) {
    switch (value) {
        case 1:
            return '星期一'
        case 2:
            return '星期二'
        case 3:
            return '星期三'
        case 4:
            return '星期四'
        case 5:
            return '星期五'
        case 6:
            return '星期六'
        case 0:
            return '星期日'
    }
}

export function getYesterday() {
    const date = new Date()
    const y = date.getFullYear()
    const m = date.getMonth() + 1
    const d = date.getDate()
    return `${y}-${m}-${d - 1}`
}

//传入时间 拿到昨天的时间
export function handleYesterday(value) {
    const date = new Date(value)
    const y = date.getFullYear()
    const m = date.getMonth() + 1
    const d = date.getDate() - 1
    return `${y}-${m}-${d}`
}
