// 获取前一天的日期
export const getPreDay = (format?: string) => {
  const n = Date.now()
  const y = new Date(n).getFullYear()
  let m = new Date(n).getMonth() + 1 as number|string
  let d = new Date(n).getDate() - 1 as number|string
  switch(format) {
    case 'YYYY-MM-DD':
      m = m < 10 ? '0' + m : m
      d = d < 10 ? '0' + d : d
      return y + '-' + m + '-' + d
    default:
      return y + '-' + m + '-' + d
  }
}

// 获取后一天的时间戳
export const getNextStamp = () => {
  const n = Date.now()
  const y = new Date(n).getFullYear()
  const m = new Date(n).getMonth() + 1 as number|string
  const d = new Date(n).getDate() + 1 as number|string
  const nstr = y + '-' + m + '-' + d
  return new Date(nstr).getTime()
}