Skip to content

Commit 47dcc76

Browse files
committed
FIX: replace timezone names with GMT offsets in TIMEZONES array
1 parent fcab523 commit 47dcc76

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

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

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ 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 }> = [
1010
{label: 'UTC', timezone: 'UTC', zone: 'UTC'},
1111
{label: 'Eastern Standard Time (New York)', timezone: 'America/New_York', zone: 'America'},
1212
{label: 'Pacific Standard Time (Los Angeles)', timezone: 'America/Los_Angeles', zone: 'America'},
@@ -35,8 +35,40 @@ export const TIMEZONES: Array<{ label: string; timezone: string, zone: string }>
3535
{label: 'Jerusalem (IST)', timezone: 'Asia/Jerusalem', zone: 'Asia'},
3636
{label: 'Buenos Aires (ART)', timezone: 'America/Argentina/Buenos_Aires', zone: 'America'},
3737
{label: 'São Paulo (BRT)', timezone: 'America/Sao_Paulo', zone: 'America'},
38+
];*/
39+
40+
export const TIMEZONES: Array<{ label: string; timezone: string, zone: string }> = [
41+
{label: getOffset('UTC'), timezone: 'UTC', zone: 'UTC'},
42+
{label: getOffset('America/New_York'), timezone: 'America/New_York', zone: 'America'},
43+
{label: getOffset('America/Los_Angeles'), timezone: 'America/Los_Angeles', zone: 'America'},
44+
{label: getOffset('America/Chicago'), timezone: 'America/Chicago', zone: 'America'},
45+
{label: getOffset('America/Denver'), timezone: 'America/Denver', zone: 'America'},
46+
{label: getOffset('America/Halifax'), timezone: 'America/Halifax', zone: 'America'},
47+
{label: getOffset('America/Anchorage'), timezone: 'America/Anchorage', zone: 'America'},
48+
{label: getOffset('Pacific/Honolulu'), timezone: 'Pacific/Honolulu', zone: 'Pacific'},
49+
{label: getOffset('Europe/London'), timezone: 'Europe/London', zone: 'Europe'},
50+
{label: getOffset('Europe/Paris'), timezone: 'Europe/Paris', zone: 'Europe'},
51+
{label: getOffset('Europe/Berlin'), timezone: 'Europe/Berlin', zone: 'Europe'},
52+
{label: getOffset('Europe/Madrid'), timezone: 'Europe/Madrid', zone: 'Europe'},
53+
{label: getOffset('Europe/Rome'), timezone: 'Europe/Rome', zone: 'Europe'},
54+
{label: getOffset('Europe/Moscow'), timezone: 'Europe/Moscow', zone: 'Europe'},
55+
{label: getOffset('Europe/Istanbul'), timezone: 'Europe/Istanbul', zone: 'Europe'},
56+
{label: getOffset('Australia/Sydney'), timezone: 'Australia/Sydney', zone: 'Australia'},
57+
{label: getOffset('Australia/Melbourne'), timezone: 'Australia/Melbourne', zone: 'Australia'},
58+
{label: getOffset('Australia/Perth'), timezone: 'Australia/Perth', zone: 'Australia'},
59+
{label: getOffset('Asia/Shanghai'), timezone: 'Asia/Shanghai', zone: 'Asia'},
60+
{label: getOffset('Asia/Tokyo'), timezone: 'Asia/Tokyo', zone: 'Asia'},
61+
{label: getOffset('Asia/Seoul'), timezone: 'Asia/Seoul', zone: 'Asia'},
62+
{label: getOffset('Asia/Singapore'), timezone: 'Asia/Singapore', zone: 'Asia'},
63+
{label: getOffset('Asia/Hong_Kong'), timezone: 'Asia/Hong_Kong', zone: 'Asia'},
64+
{label: getOffset('Asia/Kolkata'), timezone: 'Asia/Kolkata', zone: 'Asia'},
65+
{label: getOffset('Asia/Dubai'), timezone: 'Asia/Dubai', zone: 'Asia'},
66+
{label: getOffset('Asia/Jerusalem'), timezone: 'Asia/Jerusalem', zone: 'Asia'},
67+
{label: getOffset('America/Argentina/Buenos_Aires'), timezone: 'America/Argentina/Buenos_Aires', zone: 'America'},
68+
{label: getOffset('America/Sao_Paulo'), timezone: 'America/Sao_Paulo', zone: 'America'},
3869
];
3970

71+
4072
export const DATE_FORMATS: Array<{ label: string; format: string; equivalentTo: string }> = [
4173
{label: 'Short', format: 'short', equivalentTo: 'M/d/yy, h:mm a'},
4274
{label: 'Medium', format: 'medium', equivalentTo: 'MMM d, y, h:mm:ss a'},
@@ -68,3 +100,17 @@ export function getDateInfo(
68100
return formatObj ? formatObj : null;
69101
}
70102

103+
// Helper function to get the UTC offset
104+
function getOffset(timezone: string): string {
105+
const now = new Date();
106+
const options = {
107+
timeZone: timezone,
108+
timeZoneName: 'shortOffset' // Esto devuelve el offset en formato GMT±X
109+
};
110+
const formatter = new Intl.DateTimeFormat('en-US', options);
111+
const parts = formatter.formatToParts(now);
112+
113+
// Buscamos la parte que contiene el GMT±X
114+
const gmtPart = parts.find(part => part.type === 'timeZoneName');
115+
return gmtPart ? gmtPart.value : '';
116+
}

version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 10.5.8
1+
version: 10.5.9

0 commit comments

Comments
 (0)