-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Create separate TypeScript typings for every dist module
- Loading branch information
Showing
10 changed files
with
333 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ Load the main module in the browser with plain JavaScript: | |
</script> | ||
``` | ||
|
||
You can also load a specific version from CDN, for example: https://unpkg.com/[email protected].2/dist/index.umd.js. | ||
You can also load a specific version from CDN, for example: https://unpkg.com/[email protected].3/dist/index.umd.js. | ||
|
||
## Modules | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,8 +180,8 @@ Data for 2012-2022: 27 KB minified, 6.5 KB gzipped | |
Custom time zone data can be used if the module `lookup-convert` is loaded instead of the default `index` module. | ||
|
||
```html | ||
<script src="https://unpkg.com/[email protected].2/dist/lookup-convert.umd.js"></script> | ||
<script src="https://unpkg.com/[email protected].2/dist/data-2012-2022.umd.js"></script> | ||
<script src="https://unpkg.com/[email protected].3/dist/lookup-convert.umd.js"></script> | ||
<script src="https://unpkg.com/[email protected].3/dist/data-2012-2022.umd.js"></script> | ||
<script> | ||
(() => { | ||
const { populateTimeZones, findTimeZone, getZonedTime } = window['timezone-lookup-convert'] | ||
|
@@ -199,7 +199,7 @@ Custom time zone data can be used if the module `lookup-convert` is loaded inste | |
If you want to use the time zone data for years 2012-2022 published by this project, you can simplify your code by using a bundled package with both data and code. | ||
|
||
```html | ||
<script src="https://unpkg.com/[email protected].2/dist/index-2012-2022.umd.js"></script> | ||
<script src="https://unpkg.com/[email protected].3/dist/index-2012-2022.umd.js"></script> | ||
<script> | ||
(() => { | ||
const { findTimeZone, getZonedTime } = window['timezone-support'] | ||
|
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
type DateInput = Date | number | ||
|
||
interface TimeZoneInfo { | ||
name: string | ||
} | ||
|
||
interface TimeZoneOffset { | ||
abbreviation?: string | ||
offset: number | ||
} | ||
|
||
interface Time { | ||
year: number | ||
month: number | ||
day: number | ||
hours: number | ||
minutes: number | ||
seconds?: number | ||
milliseconds?: number | ||
dayOfWeek?: number | ||
epoch?: number | ||
zone?: TimeZoneOffset | ||
} | ||
|
||
interface SetTimeZoneOptions { | ||
useUTC: boolean | ||
} | ||
|
||
declare function listTimeZones (): Array<string> | ||
declare function findTimeZone (name: string): TimeZoneInfo | ||
|
||
declare function getUTCOffset (date: DateInput, timeZone: TimeZoneInfo): TimeZoneOffset | ||
declare function getZonedTime (date: DateInput, timeZone: TimeZoneInfo): Time | ||
declare function getUnixTime (time: Time, timeZone?: TimeZoneInfo): number | ||
declare function setTimeZone (time: Date | Time, timeZone: TimeZoneInfo, options?: SetTimeZoneOptions): Time | ||
|
||
declare function convertTimeToDate (time: Time): Date | ||
declare function convertDateToTime (date: Date): Time | ||
|
||
export { | ||
listTimeZones, findTimeZone, getUTCOffset, getZonedTime, getUnixTime, setTimeZone, convertTimeToDate, convertDateToTime | ||
} | ||
|
||
// export as namespace timezoneSupport; |
Oops, something went wrong.