Files
twenty/packages/twenty-front/src/modules/settings/accounts/constants/AvailableTimezoneOptionsByLabel.ts
Paul Rastoin 3c9bf2294f test(front): fix main failing test due to timezone (#11295)
# Introduction
Due to winter to summer timezone update, it shown that we have some unit
tests flakiness due to both mocked and unmocked date.now invokation
between app bootstrap and test bootstrap

This PR does not refactor this behavior
Just fix the currently failing test

## Note
Removed a duplicated file
2025-03-31 15:39:05 +02:00

31 lines
970 B
TypeScript

/* eslint-disable @typescript-eslint/naming-convention */
/* eslint-disable @nx/workspace-max-consts-per-file */
import { IANA_TIME_ZONES } from '@/localization/constants/IanaTimeZones';
import { formatTimeZoneLabel } from '@/localization/utils/formatTimeZoneLabel';
import { SelectOption } from 'twenty-ui';
export const AVAILABLE_TIME_ZONE_OPTIONS_BY_LABEL = IANA_TIME_ZONES.reduce<
Record<string, SelectOption>
>((result, ianaTimeZone) => {
const timeZoneLabel = formatTimeZoneLabel(ianaTimeZone);
// Remove the '(GMT±00:00) ' prefix from the label.
const timeZoneName = timeZoneLabel.slice(11);
// Skip time zones with GMT, UTC, or UCT in their name,
// and duplicates.
if (
timeZoneName.includes('GMT') ||
timeZoneName.includes('UTC') ||
timeZoneName.includes('UCT') ||
timeZoneLabel in result
) {
return result;
}
return {
...result,
[timeZoneLabel]: { label: timeZoneLabel, value: ianaTimeZone },
};
}, {});