Files
twenty/packages/twenty-front/src/modules/localization/utils/detectTimeFormat.ts
T
Félix Malfait 464a480043 Continue ESLINT9 Migration (#13795)
Might already fix #13793
2025-08-10 23:25:58 +02:00

15 lines
391 B
TypeScript

import { type TimeFormat } from '@/localization/constants/TimeFormat';
import { isDefined } from 'twenty-shared/utils';
export const detectTimeFormat = (): keyof typeof TimeFormat => {
const isHour12 = Intl.DateTimeFormat(navigator.language, {
hour: 'numeric',
}).resolvedOptions().hour12;
if (isDefined(isHour12) && isHour12) {
return 'HOUR_12';
}
return 'HOUR_24';
};