Files
twenty/packages/twenty-front/src/modules/localization/utils/formatDateISOStringToDateTime.ts
T
ccf4d1eeec Date formatting per workspace member settings (#6408)
Implement date formatting per workspace member settings

We'll need another round to maybe initialize all workspaces on the
default settings.

For now the default behavior is to take system settings if nothing is
found in DB.

---------

Co-authored-by: Weiko <corentin@twenty.com>
2024-07-30 14:52:10 +02:00

17 lines
427 B
TypeScript

import { DateFormat } from '@/localization/constants/DateFormat';
import { TimeFormat } from '@/localization/constants/TimeFormat';
import { formatInTimeZone } from 'date-fns-tz';
export const formatDateISOStringToDateTime = (
date: string,
timeZone: string,
dateFormat: DateFormat,
timeFormat: TimeFormat,
) => {
return formatInTimeZone(
new Date(date),
timeZone,
`${dateFormat} ${timeFormat}`,
);
};