10 lines
240 B
TypeScript
10 lines
240 B
TypeScript
import { formatInTimeZone } from 'date-fns-tz';
|
|
|
|
export const formatDate = (
|
|
date: Date | string,
|
|
formatStr: string = 'dd.MM.yyyy HH:mm',
|
|
) => {
|
|
const utcDate = new Date(date);
|
|
return formatInTimeZone(utcDate, 'UTC', formatStr);
|
|
};
|