Files
twenty/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarDateFormatSelect.tsx
Lucas Bordeau 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

35 lines
905 B
TypeScript

import { formatInTimeZone } from 'date-fns-tz';
import { DateFormat } from '@/localization/constants/DateFormat';
import { Select } from '@/ui/input/components/Select';
type SettingsAccountsCalendarDateFormatSelectProps = {
value: DateFormat;
onChange: (nextValue: DateFormat) => void;
timeZone: string;
};
export const SettingsAccountsCalendarDateFormatSelect = ({
onChange,
timeZone,
value,
}: SettingsAccountsCalendarDateFormatSelectProps) => (
<Select
dropdownId="settings-accounts-calendar-date-format"
label="Date format"
fullWidth
value={value}
options={[
{
label: formatInTimeZone(Date.now(), timeZone, DateFormat.MONTH_FIRST),
value: DateFormat.MONTH_FIRST,
},
{
label: formatInTimeZone(Date.now(), timeZone, DateFormat.DAY_FIRST),
value: DateFormat.DAY_FIRST,
},
]}
onChange={onChange}
/>
);