File: index.d.ts

package info (click to toggle)
moment-timezone.js 0.5.46%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 768 kB
  • sloc: javascript: 3,407; makefile: 63
file content (78 lines) | stat: -rw-r--r-- 3,086 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Type definitions for moment-timezone.js 0.5
// Project: http://momentjs.com/timezone/
// Definitions by: Michel Salib <https://github.com/michelsalib>
//                 Alan Brazil Lins <https://github.com/alanblins>
//                 Agustin Carrasco <https://github.com/asermax>
//                 Borys Kupar <https://github.com/borys-kupar>
//                 Anthony Rainer <https://github.com/pristinesource>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Migrated here from DefinitelyTyped in release moment-timezone@0.5.30

import moment = require('moment');

declare module 'moment' {
    interface MomentZone {
        name: string;
        abbrs: string[];
        untils: number[];
        offsets: number[];
        population: number;

        abbr(timestamp: number): string;
        offset(timestamp: number): number;
        utcOffset(timestamp: number): number;
        parse(timestamp: number): number;
    }

    interface MomentZoneOffset {
        name: string;
        offset: number;
    }

    interface MomentTimezone {
        (): moment.Moment;
        (timezone: string): moment.Moment;
        (date: number, timezone: string): moment.Moment;
        (date: number[], timezone: string): moment.Moment;
        (date: string, timezone: string): moment.Moment;
        (date: string, format: moment.MomentFormatSpecification, timezone: string): moment.Moment;
        (date: string, format: moment.MomentFormatSpecification, strict: boolean, timezone: string): moment.Moment;
        (date: string, format: moment.MomentFormatSpecification, language: string, timezone: string): moment.Moment;
        (date: string, format: moment.MomentFormatSpecification, language: string, strict: boolean, timezone: string): moment.Moment;
        (date: Date, timezone: string): moment.Moment;
        (date: moment.Moment, timezone: string): moment.Moment;
        (date: any, timezone: string): moment.Moment;

        zone(timezone: string): MomentZone | null;

        add(packedZoneString: string): void;
        add(packedZoneString: string[]): void;

        link(packedLinkString: string): void;
        link(packedLinkString: string[]): void;

        load(data: { version: string; links: string[]; zones: string[] }): void;

        names(): string[];
        zonesForCountry<T extends true>(country: string, with_offset: T): T extends true ? MomentZoneOffset[] : never;
        zonesForCountry<T extends false>(country: string, with_offset?: T): T extends false ? string[] : never;
        zonesForCountry(country: string, with_offset?: boolean): MomentZoneOffset[] | string[];
        countries(): string[];
        guess(ignoreCache?: boolean): string;

        setDefault(timezone?: string): Moment;
        dataVersion: string;
    }

    interface Moment {
        tz(): string | undefined;
        tz(timezone: string, keepLocalTime?: boolean): moment.Moment;
        zoneAbbr(): string;
        zoneName(): string;
    }

    const tz: MomentTimezone;
}

// require("moment-timezone") === require("moment")
export = moment;