Files
accounted/lib/hooks/use-format.ts
T
Mattsson e4488a900b feat: add user locale preference to user_preferences table (#555)
* feat: add user locale preference to user_preferences table

- Introduced a new column 'locale' in the user_preferences table to store per-user UI language preferences.
- Added a CHECK constraint to ensure only supported locales ('sv', 'en') are allowed.
- Triggered a schema reload notification for the changes.

chore: declare CSS module support in TypeScript

- Added a declaration for CSS modules in globals.d.ts to enable TypeScript support for importing CSS files.

* feat: add Swish as an invoice payment method in company settings
2026-05-21 21:33:22 +02:00

21 lines
594 B
TypeScript

'use client'
import { useLocale } from 'next-intl'
import { formatDateLong as formatDateLongRaw } from '@/lib/utils'
/**
* Client-side hook returning locale-aware formatters.
*
* Currency stays SEK with sv-SE conventions (1 234,56 kr) regardless of UI
* language — that's the Swedish accounting standard, not a UI string.
* formatDate (ISO yyyy-MM-dd) is locale-independent and exported directly
* from lib/utils.
*/
export function useFormat() {
const locale = useLocale()
return {
locale,
formatDateLong: (date: Date | string) => formatDateLongRaw(date, locale),
}
}