Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

675 B
Raw Blame
'use client';

import { useLocale } from 'next-intl';
import {
  enUS,
  uk,
  ru,
  zhCN,
  zhTW,
  ar,
  faIR,
  fr,
  ptBR,
  id,
  es,
  ko,
  tr,
  type Locale as DateFnsLocale,
} from 'date-fns/locale';

// The date-fns locale matching the interface language, for the components that
// format dates themselves instead of going through next-intl (the calendar's
// month and weekday names).
const LOCALES: Record<string, DateFnsLocale> = {
  en: enUS,
  uk,
  ru,
  'zh-CN': zhCN,
  'zh-TW': zhTW,
  ar,
  fa: faIR,
  fr,
  'pt-BR': ptBR,
  id,
  'es-ES': es,
  ko,
  tr,
};

export function useDateFnsLocale(): DateFnsLocale {
  return LOCALES[useLocale()] ?? enUS;
}