/**
 * Return date in compact format e.G. 13.08
 */
export const useCompactDate = (date: string) => {
  return date.substring(8, 10) + '.' + date.substring(5, 7) + '.'
}

/**
 * Return date in user friendly format
 * in format DD.MM.YYYY
 *
 */
export const useDate = (date: string) => {
  return (
    date.substring(8, 10) +
    '.' +
    date.substring(5, 7) +
    '.' +
    date.substring(0, 4)
  )
}

export const useShortDayName = (date: string) => {
  const day = new Date(date);
  const days = [
    "So",
    "Mo",
    "Di",
    "Mi",
    "Do",
    "Fr",
    "Sa"
  ]

  return days[day.getDay()]
}
