import { format } from 'date-fns';
import { enUS } from 'date-fns/locale';

export function formatDate(date, fmt = 'dd.MM.y', locale = enUS) {
  const dt = new Date(date);
  return format(dt, fmt, { locale });
}

export function formatDateInput(date, fmt = 'y-MM-dd', locale = enUS) {
  const dt = new Date(date);
  return format(dt, fmt, { locale });
}

export function formatDateTime(date) {
  const dt = new Date(date);
  return format(dt, 'hh:mm dd.MM.y');
}

export function formatDateSrb(date) {
  const dt = new Date(date);
  return format(dt, 'dd.MM.');
}

export function formatTimeSrb(date) {
  const dt = new Date(date);
  return format(dt, 'HH:mm');
}