import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
import "dayjs/locale/cs";

dayjs.extend(relativeTime);
dayjs.locale("cs");

export function formatRelative(date: string | Date | null | undefined): string {
  if (!date) return "";
  return dayjs(date).fromNow();
}

export function formatAbsolute(date: string | Date | null | undefined): string {
  if (!date) return "";
  return dayjs(date).format("DD.MM.YYYY HH:mm");
}
