@@ -6,7 +6,7 @@ export const DEFAULT_DATE_SETTING_DATE = 'medium';
66export const DATE_SETTING_TIMEZONE_SHORT = 'utmstack.time.zone' ;
77export 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,40 +35,8 @@ export const DATE_SETTING_FORMAT_SHORT = 'utmstack.time.dateformat';
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' } ,
6938] ;
7039
71-
7240export const DATE_FORMATS : Array < { label : string ; format : string ; equivalentTo : string } > = [
7341 { label : 'Short' , format : 'short' , equivalentTo : 'M/d/yy, h:mm a' } ,
7442 { label : 'Medium' , format : 'medium' , equivalentTo : 'MMM d, y, h:mm:ss a' } ,
@@ -100,17 +68,3 @@ export function getDateInfo(
10068 return formatObj ? formatObj : null ;
10169}
10270
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- }
0 commit comments