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

43 lines
997 B
TypeScript

import { formatInTimeZone } from 'date-fns-tz';
import { TimeFormat } from '@/localization/constants/TimeFormat';
import { Select } from '@/ui/input/components/Select';
type SettingsAccountsCalendarTimeFormatSelectProps = {
value: TimeFormat;
onChange: (nextValue: TimeFormat) => void;
timeZone: string;
};
export const SettingsAccountsCalendarTimeFormatSelect = ({
onChange,
timeZone,
value,
}: SettingsAccountsCalendarTimeFormatSelectProps) => (
<Select
dropdownId="settings-accounts-calendar-time-format"
label="Time format"
fullWidth
value={value}
options={[
{
label: `24h (${formatInTimeZone(
Date.now(),
timeZone,
TimeFormat.HOUR_24,
)})`,
value: TimeFormat.HOUR_24,
},
{
label: `12h (${formatInTimeZone(
Date.now(),
timeZone,
TimeFormat.HOUR_12,
)})`,
value: TimeFormat.HOUR_12,
},
]}
onChange={onChange}
/>
);