1 | import moment = require('moment');
|
2 | import { MomentTimezone } from "./index";
|
3 |
|
4 | declare module 'moment' {
|
5 |
|
6 | /** Parsed / unpacked zone data. */
|
7 | interface UnpackedZone {
|
8 | /** The uniquely identifying name of the time zone. */
|
9 | name: string;
|
10 | /** zone abbreviations */
|
11 | abbrs: Array<string>;
|
12 | /** (measured in milliseconds) */
|
13 | untils: Array<number | null>;
|
14 | /** (measured in minutes) */
|
15 | offsets: Array<number>;
|
16 | }
|
17 |
|
18 | /** Bundle of zone data and links for multiple timezones */
|
19 | interface PackedZoneBundle {
|
20 | version: string;
|
21 | zones: Array<string>;
|
22 | links: Array<string>;
|
23 | }
|
24 |
|
25 | /** Bundle of zone data and links for multiple timezones */
|
26 | interface UnpackedZoneBundle {
|
27 | version: string;
|
28 | zones: Array<UnpackedZone>;
|
29 | links: Array<string>;
|
30 | }
|
31 |
|
32 | /** extends MomentTimezone declared in index */
|
33 | interface MomentTimezone {
|
34 | /** Converts zone data in the unpacked format to the packed format. */
|
35 | pack(unpackedObject: UnpackedZone): string;
|
36 |
|
37 | /** Convert a base 10 number to a base 60 string. */
|
38 | packBase60(input: number, precision?: number): string;
|
39 |
|
40 | /** Create links out of two zones that share data.
|
41 | * @returns A new ZoneBundle with duplicate zone data replaced by links
|
42 | */
|
43 | createLinks(unlinked: UnpackedZoneBundle): PackedZoneBundle;
|
44 |
|
45 | /**
|
46 | * Filter out data for years outside a certain range.
|
47 | * @return a new, filtered UnPackedZone object
|
48 | */
|
49 | filterYears(unpackedZone: UnpackedZone, startYear: number, endYear: number): UnpackedZone;
|
50 | /**
|
51 | * Filter out data for years outside a certain range.
|
52 | * @return a new, filtered UnPackedZone object
|
53 | */
|
54 | filterYears(unpackedZone: UnpackedZone, startAndEndYear: number): UnpackedZone;
|
55 |
|
56 | /**
|
57 | * Combines packing, link creation, and subsetting of years into one simple interface.
|
58 | * Pass in an unpacked bundle, start year, and end year and get a filtered, linked, packed bundle back.
|
59 | */
|
60 | filterLinkPack(unpackedBundle: UnpackedZoneBundle, startYear: number, endYear: number): PackedZoneBundle;
|
61 | /**
|
62 | * Combines packing, link creation, and subsetting of years into one simple interface.
|
63 | * Pass in an unpacked bundle, start year, and end year and get a filtered, linked, packed bundle back.
|
64 | */
|
65 | filterLinkPack(unpackedBundle: UnpackedZoneBundle, startAndEndYear: number): PackedZoneBundle;
|
66 | }
|
67 | }
|
68 |
|
69 | // require("moment-timezone") === require("moment")
|
70 | export = moment;
|