export function formatTimeStr(time: string | Date, format: string) {
  const date = new Date(time)
  const formatObj: any = {
    YYYY: date.getFullYear(),
    MM: date.getMonth() + 1,
    DD: date.getDate(),
    HH: date.getHours(),
    mm: date.getMinutes(),
    ss: date.getSeconds(),
  }
  const time_str = format.replace(/(YYYY|MM|DD|HH|mm|ss)/g, (result, key) => {
    const value = formatObj[key]
    return value.toString().padStart(2, '0')
  })

  return time_str
}
