diff --git a/.gitignore b/.gitignore index 2f61648..4a67ebd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +.idea coverage dist examples/**/out diff --git a/src/index.d.ts b/src/index.d.ts index 6e95fc9..550c4c9 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -31,6 +31,7 @@ interface SetTimeZoneOptions { } declare function listTimeZones (): Array +declare function getTimeZoneLinks (): { [alias: string]: string } declare function findTimeZone (name: string): TimeZoneInfo declare function getUTCOffset (date: DateInput, timeZone: TimeZoneInfo): TimeZoneOffset @@ -42,8 +43,8 @@ declare function convertTimeToDate (time: Time): Date declare function convertDateToTime (date: Date): Time export { - listTimeZones, findTimeZone, getUTCOffset, getZonedTime, getUnixTime, - setTimeZone, convertTimeToDate, convertDateToTime + listTimeZones, getTimeZoneLinks, findTimeZone, getUTCOffset, getZonedTime, + getUnixTime, setTimeZone, convertTimeToDate, convertDateToTime } // export as namespace timezoneSupport; diff --git a/src/index.js b/src/index.js index 7183bb7..ab08490 100644 --- a/src/index.js +++ b/src/index.js @@ -1,12 +1,12 @@ import { - populateTimeZones, listTimeZones, findTimeZone, getUTCOffset, getZonedTime, - getUnixTime, setTimeZone, convertTimeToDate, convertDateToTime + populateTimeZones, listTimeZones, getTimeZoneLinks, findTimeZone, getUTCOffset, + getZonedTime, getUnixTime, setTimeZone, convertTimeToDate, convertDateToTime } from './lookup-convert' import data from './lookup/data' populateTimeZones(data) export { - listTimeZones, findTimeZone, getUTCOffset, getZonedTime, getUnixTime, - setTimeZone, convertTimeToDate, convertDateToTime + listTimeZones, getTimeZoneLinks, findTimeZone, getUTCOffset, getZonedTime, + getUnixTime, setTimeZone, convertTimeToDate, convertDateToTime } diff --git a/src/lookup-convert.d.ts b/src/lookup-convert.d.ts index 0ba2d92..5681c40 100644 --- a/src/lookup-convert.d.ts +++ b/src/lookup-convert.d.ts @@ -37,6 +37,7 @@ interface TimeZoneData { declare function populateTimeZones (TimeZoneData): void declare function listTimeZones (): Array +declare function getTimeZoneLinks (): { [alias: string]: string } declare function findTimeZone (name: string): TimeZoneInfo declare function getUTCOffset (date: DateInput, timeZone: TimeZoneInfo): TimeZoneOffset @@ -48,8 +49,8 @@ declare function convertTimeToDate (time: Time): Date declare function convertDateToTime (date: Date): Time export { - populateTimeZones, listTimeZones, findTimeZone, getUTCOffset, getZonedTime, - getUnixTime, setTimeZone, convertTimeToDate, convertDateToTime + populateTimeZones, listTimeZones, getTimeZoneLinks, findTimeZone, getUTCOffset, + getZonedTime, getUnixTime, setTimeZone, convertTimeToDate, convertDateToTime } // export as namespace timezoneLookupConvert; diff --git a/src/lookup-convert.js b/src/lookup-convert.js index 15e5ac7..76c729a 100644 --- a/src/lookup-convert.js +++ b/src/lookup-convert.js @@ -1,2 +1,2 @@ -export { populateTimeZones, listTimeZones, findTimeZone } from './lookup/lookup' +export { populateTimeZones, listTimeZones, getTimeZoneLinks, findTimeZone } from './lookup/lookup' export { getUTCOffset, getZonedTime, getUnixTime, setTimeZone, convertTimeToDate, convertDateToTime } from './convert/convert' diff --git a/src/lookup/lookup.js b/src/lookup/lookup.js index 8bca5bc..15f0ead 100644 --- a/src/lookup/lookup.js +++ b/src/lookup/lookup.js @@ -24,6 +24,10 @@ function listTimeZones () { return names.slice() } +function getTimeZoneLinks () { + return Object.assign({}, links) +} + function findTimeZone (alias) { const name = links[alias] || alias let timeZone = instances[name] @@ -37,4 +41,4 @@ function findTimeZone (alias) { return timeZone } -export { populateTimeZones, listTimeZones, findTimeZone } +export { populateTimeZones, listTimeZones, getTimeZoneLinks, findTimeZone }