This commit is contained in:
MDeeApp
2025-10-11 01:17:31 +02:00
commit 8eb060f380
1223 changed files with 265299 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { format, parseISO } from "date-fns";
import { de } from "date-fns/locale";
export function formatDate(date: string | null | undefined, pattern = "dd.MM.yyyy"): string {
if (!date) return "";
try {
return format(parseISO(date), pattern, { locale: de });
} catch {
return date;
}
}
export function formatDeadlineDate(date: string | null | undefined): string {
return formatDate(date);
}
export function formatCurrency(amount: number | null | undefined, currency = "EUR"): string {
if (amount === null || amount === undefined) {
return "";
}
return new Intl.NumberFormat("de-DE", { style: "currency", currency }).format(amount);
}