Files
twenty/packages/twenty-front/src/modules/localization/utils/formatDateISOStringToCustomUnicodeFormat.ts
T
Félix MalfaitandGitHub b44b46109c Update try/catch syntax (#13732)
Update try/catch syntax to prepare for eslint migration
2025-08-07 22:19:43 +02:00

22 lines
423 B
TypeScript

import { formatInTimeZone } from 'date-fns-tz';
export const formatDateISOStringToCustomUnicodeFormat = ({
date,
timeZone,
dateFormat,
localeCatalog,
}: {
date: string;
timeZone: string;
dateFormat: string;
localeCatalog: Locale;
}) => {
try {
return formatInTimeZone(new Date(date), timeZone, dateFormat, {
locale: localeCatalog,
});
} catch {
return 'Invalid format string';
}
};