export const toNumber = (v: number) => {
  return String(v).length === 1 ? '0' + v : v
}

export const getTime = (date: Date = new Date()) => {
  return `${toNumber(date.getHours())}:${toNumber(
    date.getMinutes()
  )}:${toNumber(date.getSeconds())}`
}

export const delay = (duration: number) => {
  return new Promise<void>((resolve) => {
    setTimeout(() => {
      resolve()
    }, duration)
  })
}
