import dayjs from 'dayjs'
/**
 * @description: 转换时间
 */

export const filterDateTwo = function (time: string): string {
  if (!time) return ''
  return dayjs(time).format('YYYY-MM-DD')
}

/**
 * @description: 获取近7天日期
 */
export const recentSevenDays = function () {
  const dates = []
  for (let i = 0; i < 7; i++) {
    const date = dayjs().subtract(i, 'day')
    dates.push(date.format('YYYY-MM-DD'))
  }

  return dates
}
