13 lines
387 B
TypeScript
13 lines
387 B
TypeScript
export function datum(value: string | Date | null | undefined): string {
|
||
if (!value) return "–";
|
||
return new Intl.DateTimeFormat("de-DE", {
|
||
dateStyle: "short",
|
||
timeStyle: "medium",
|
||
timeZone: "Europe/Berlin",
|
||
}).format(new Date(value));
|
||
}
|
||
|
||
export function kurz(value: string, max = 42): string {
|
||
return value.length > max ? `${value.slice(0, max - 1)}…` : value;
|
||
}
|