diff options
| author | Dawid Rycerz <dawid@rycerz.xyz> | 2026-01-13 18:42:05 +0100 |
|---|---|---|
| committer | Dawid Rycerz <dawid@rycerz.xyz> | 2026-01-13 18:42:05 +0100 |
| commit | a1d3fb8df0e00faa3920d7f5085a52002e58574e (patch) | |
| tree | 288c0a6003e7069338035a0a0e3864414b3e071b /src/utils | |
| parent | 9fe4480c3981c38ae8e24d0495df957039864a5d (diff) | |
Add polish language support
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/date.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/utils/date.ts b/src/utils/date.ts index 314a837..035d157 100644 --- a/src/utils/date.ts +++ b/src/utils/date.ts @@ -4,12 +4,14 @@ import { siteConfig } from "@/site.config"; export function getFormattedDate( date: Date | undefined, options?: Intl.DateTimeFormatOptions, + locale?: string, ): string { if (date === undefined) { return "Invalid Date"; } - return new Intl.DateTimeFormat(siteConfig.date.locale, { + const effectiveLocale = locale === "pl" ? "pl-PL" : siteConfig.date.locale; + return new Intl.DateTimeFormat(effectiveLocale, { ...(siteConfig.date.options as Intl.DateTimeFormatOptions), ...options, }).format(date); |
