/**
 * Get formatted UNIX date
 */
export function fmtUnixDate(time: number): string {
  return new Date(time * 1000).toLocaleString("fr-FR");
}

/**
 * Get formatted UNIX date for Full Calendar
 */
export function fmtUnixDateFullCalendar(
  time: number,
  correctEnd: boolean
): string {
  let d = new Date(time * 1000);

  if (d.getHours() > 0 && correctEnd)
    d = new Date(time * 1000 + 3600 * 24 * 1000);

  const s = `${d.getFullYear()}-${(d.getMonth() + 1)
    .toString(10)
    .padStart(2, "0")}-${d.getDate().toString(10).padStart(2, "0")}`; /*T${d
    .getHours()
    .toString(10)
    .padStart(2, "0")}:${d.getMinutes().toString(10).padStart(2, "0")}:${d
    .getSeconds()
    .toString(10)
    .padStart(2, "0")}`*/

  return s;
}
