Skip to content

Commit 156ef11

Browse files
committed
feat: enhance timezone handling by dynamically generating timezone list
Signed-off-by: Manuel Abascal <mjabascal10@gmail.com>
1 parent 4fa4cea commit 156ef11

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

frontend/src/app/shared/constants/date-timezone-date.const.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,19 @@ export const DEFAULT_DATE_SETTING_DATE = 'medium';
66
export const DATE_SETTING_TIMEZONE_SHORT = 'utmstack.time.zone';
77
export const DATE_SETTING_FORMAT_SHORT = 'utmstack.time.dateformat';
88

9-
export const TIMEZONES: Array<{ label: string; timezone: string, zone: string }> = [
9+
export const TIMEZONES: Array<{ label: string; timezone: string; zone: string }> =
10+
moment.tz.names().map((tz) => {
11+
const parts = tz.split('/');
12+
const zone = parts[0] || 'Other';
13+
const label = tz.replace(/_/g, ' ');
14+
return {
15+
label,
16+
timezone: tz,
17+
zone
18+
};
19+
});
20+
21+
/*export const TIMEZONES: Array<{ label: string; timezone: string, zone: string }> = [
1022
{label: 'UTC', timezone: 'UTC', zone: 'UTC'},
1123
{label: 'Eastern Standard Time (New York)', timezone: 'America/New_York', zone: 'America'},
1224
{label: 'Pacific Standard Time (Los Angeles)', timezone: 'America/Los_Angeles', zone: 'America'},
@@ -38,7 +50,7 @@ export const TIMEZONES: Array<{ label: string; timezone: string, zone: string }>
3850
{label: 'Jerusalem (IST)', timezone: 'Asia/Jerusalem', zone: 'Asia'},
3951
{label: 'Buenos Aires (ART)', timezone: 'America/Argentina/Buenos_Aires', zone: 'America'},
4052
{label: 'São Paulo (BRT)', timezone: 'America/Sao_Paulo', zone: 'America'},
41-
];
53+
];*/
4254
export const DATE_FORMATS: Array<{ label: string; format: string; equivalentTo: string }> = [
4355
{label: 'Short', format: 'short', equivalentTo: 'M/d/yy, h:mm a'},
4456
{label: 'Medium', format: 'medium', equivalentTo: 'MMM d, y, h:mm:ss a'},

0 commit comments

Comments
 (0)