mirror of
https://github.com/biersoeckli/QuickStack.git
synced 2026-05-16 23:09:15 -05:00
23 lines
590 B
TypeScript
23 lines
590 B
TypeScript
|
|
import { formatInTimeZone } from 'date-fns-tz';
|
|
|
|
export function formatDate(date: Date | undefined | null): string {
|
|
if (!date) {
|
|
return '';
|
|
}
|
|
return formatInTimeZone(date, 'Europe/Zurich', 'dd.MM.yyyy');
|
|
}
|
|
|
|
export function formatDateTime(date: Date | undefined | null): string {
|
|
if (!date) {
|
|
return '';
|
|
}
|
|
return formatInTimeZone(date, 'Europe/Zurich', 'dd.MM.yyyy HH:mm');
|
|
}
|
|
|
|
export function formatTime(date: Date | undefined | null): string {
|
|
if (!date) {
|
|
return '';
|
|
}
|
|
return formatInTimeZone(date, 'Europe/Zurich', 'HH:mm');
|
|
} |