@universe/util
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -86,1 +86,18 @@ export declare const isNull: (v: unknown) => v is null; | ||
export declare const utcHourToLocal: (hour: number) => number; | ||
declare enum TimeZone { | ||
US_ALASKA = "US/Alaska", | ||
US_ALEUTIAN = "US/Aleutian", | ||
US_ARIZONA = "US/Arizona", | ||
US_CENTRAL = "US/Central", | ||
US_EAST_INDIANA = "US/East-Indiana", | ||
US_EASTERN = "US/Eastern", | ||
US_HAWAII = "US/Hawaii", | ||
US_INDIANA_STARKE = "US/Indiana-Starke", | ||
US_MICHIGAN = "US/Michigan", | ||
US_MOUNTAIN = "US/Mountain", | ||
US_PACIFIC = "US/Pacific", | ||
US_SAMOA = "US/Samoa", | ||
ETC_GMT = "Etc/GMT" | ||
} | ||
export declare function getTimezone(): TimeZone; | ||
export {}; |
@@ -86,1 +86,18 @@ export declare const isNull: (v: unknown) => v is null; | ||
export declare const utcHourToLocal: (hour: number) => number; | ||
declare enum TimeZone { | ||
US_ALASKA = "US/Alaska", | ||
US_ALEUTIAN = "US/Aleutian", | ||
US_ARIZONA = "US/Arizona", | ||
US_CENTRAL = "US/Central", | ||
US_EAST_INDIANA = "US/East-Indiana", | ||
US_EASTERN = "US/Eastern", | ||
US_HAWAII = "US/Hawaii", | ||
US_INDIANA_STARKE = "US/Indiana-Starke", | ||
US_MICHIGAN = "US/Michigan", | ||
US_MOUNTAIN = "US/Mountain", | ||
US_PACIFIC = "US/Pacific", | ||
US_SAMOA = "US/Samoa", | ||
ETC_GMT = "Etc/GMT" | ||
} | ||
export declare function getTimezone(): TimeZone; | ||
export {}; |
{ | ||
"name": "@universe/util", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"main": "dist/cjs/src/index.js", | ||
@@ -5,0 +5,0 @@ "description": "Universe development utilities.", |
@@ -491,1 +491,51 @@ /* eslint-disable max-len */ | ||
}; | ||
enum TimeZone { | ||
US_ALASKA = 'US/Alaska', | ||
US_ALEUTIAN = 'US/Aleutian', | ||
US_ARIZONA = 'US/Arizona', | ||
US_CENTRAL = 'US/Central', | ||
US_EAST_INDIANA = 'US/East-Indiana', | ||
US_EASTERN = 'US/Eastern', | ||
US_HAWAII = 'US/Hawaii', | ||
US_INDIANA_STARKE = 'US/Indiana-Starke', | ||
US_MICHIGAN = 'US/Michigan', | ||
US_MOUNTAIN = 'US/Mountain', | ||
US_PACIFIC = 'US/Pacific', | ||
US_SAMOA = 'US/Samoa', | ||
ETC_GMT = 'Etc/GMT', // Greenwich time | ||
} | ||
export function getTimezone(): TimeZone { | ||
const tmp = Intl.DateTimeFormat().resolvedOptions().timeZone; | ||
if (tmp in TimeZone) { return tmp as TimeZone; } | ||
switch(tmp) { | ||
case 'America/Anchorage': | ||
return TimeZone.US_ALASKA; | ||
case 'America/Adak': | ||
return TimeZone.US_ALEUTIAN; | ||
case 'America/Phoenix': | ||
return TimeZone.US_ARIZONA; | ||
case 'America/Chicago': | ||
return TimeZone.US_CENTRAL; | ||
case 'America/Indiana/Indianapolis': | ||
return TimeZone.US_EAST_INDIANA; | ||
case 'America/New_York': | ||
return TimeZone.US_EASTERN; | ||
case 'America/Indiana/Knox': | ||
return TimeZone.US_INDIANA_STARKE; | ||
case 'America/Detroit': | ||
return TimeZone.US_MICHIGAN; | ||
case 'America/Denver': | ||
return TimeZone.US_MOUNTAIN; | ||
case 'Pacific/Honolulu': | ||
return TimeZone.US_HAWAII; | ||
case 'America/Los_Angeles': | ||
return TimeZone.US_PACIFIC; | ||
case 'Pacific/Pago_Pago': | ||
return TimeZone.US_SAMOA; | ||
default: | ||
return TimeZone.US_PACIFIC; | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
655757
2601