diff --git a/moment.d.ts b/moment.d.ts index 97c29bdf1a..bd9d87b836 100644 --- a/moment.d.ts +++ b/moment.d.ts @@ -4,13 +4,13 @@ */ declare function moment(inp?: moment.MomentInput, strict?: boolean): moment.Moment; /** - * @param strict Strict parsing requires that the format and input match exactly, including delimeters. + * @param strict Strict parsing requires that the format and input match exactly, including delimiters. * Strict parsing is frequently the best parsing option. For more information about choosing strict vs * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/). */ declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, strict?: boolean): moment.Moment; /** - * @param strict Strict parsing requires that the format and input match exactly, including delimeters. + * @param strict Strict parsing requires that the format and input match exactly, including delimiters. * Strict parsing is frequently the best parsing option. For more information about choosing strict vs * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/). */ @@ -663,7 +663,22 @@ declare namespace moment { export var fn: Moment; // NOTE(constructor): Same as moment constructor + /** + * @param strict Strict parsing disables the deprecated fallback to the native Date constructor when + * parsing a string. + */ + export function utc(inp?: MomentInput, strict?: boolean): Moment; + /** + * @param strict Strict parsing requires that the format and input match exactly, including delimiters. + * Strict parsing is frequently the best parsing option. For more information about choosing strict vs + * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/). + */ export function utc(inp?: MomentInput, format?: MomentFormatSpecification, strict?: boolean): Moment; + /** + * @param strict Strict parsing requires that the format and input match exactly, including delimiters. + * Strict parsing is frequently the best parsing option. For more information about choosing strict vs + * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/). + */ export function utc(inp?: MomentInput, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment; export function unix(timestamp: number): Moment; diff --git a/ts3.1-typing-tests/moment-tests.ts b/ts3.1-typing-tests/moment-tests.ts index a04d56af14..a7ddc5d08f 100644 --- a/ts3.1-typing-tests/moment-tests.ts +++ b/ts3.1-typing-tests/moment-tests.ts @@ -23,6 +23,8 @@ var day10 = moment([2010, 6, 10]); var array = [2010, 1, 14, 15, 25, 50, 125]; var day11 = moment(Date.UTC.apply({}, array)); var day12 = moment.unix(1318781876); +var day13 = moment("/Date(1198908717056-0700)/", true); +var day14 = moment("foobazbar", 'L', true); moment(null); moment(undefined); diff --git a/ts3.1-typings/moment.d.ts b/ts3.1-typings/moment.d.ts index 6b82f99534..a04270f660 100644 --- a/ts3.1-typings/moment.d.ts +++ b/ts3.1-typings/moment.d.ts @@ -1,4 +1,19 @@ +/** + * @param strict Strict parsing disables the deprecated fallback to the native Date constructor when + * parsing a string. + */ +declare function moment(inp?: moment.MomentInput, strict?: boolean): moment.Moment; +/** + * @param strict Strict parsing requires that the format and input match exactly, including delimiters. + * Strict parsing is frequently the best parsing option. For more information about choosing strict vs + * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/). + */ declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, strict?: boolean): moment.Moment; +/** + * @param strict Strict parsing requires that the format and input match exactly, including delimiters. + * Strict parsing is frequently the best parsing option. For more information about choosing strict vs + * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/). + */ declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, language?: string, strict?: boolean): moment.Moment; declare namespace moment { @@ -636,7 +651,22 @@ declare namespace moment { export var fn: Moment; // NOTE(constructor): Same as moment constructor + /** + * @param strict Strict parsing disables the deprecated fallback to the native Date constructor when + * parsing a string. + */ + export function utc(inp?: MomentInput, strict?: boolean): Moment; + /** + * @param strict Strict parsing requires that the format and input match exactly, including delimiters. + * Strict parsing is frequently the best parsing option. For more information about choosing strict vs + * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/). + */ export function utc(inp?: MomentInput, format?: MomentFormatSpecification, strict?: boolean): Moment; + /** + * @param strict Strict parsing requires that the format and input match exactly, including delimiters. + * Strict parsing is frequently the best parsing option. For more information about choosing strict vs + * forgiving parsing, see the [parsing guide](https://momentjs.com/guides/#/parsing/). + */ export function utc(inp?: MomentInput, format?: MomentFormatSpecification, language?: string, strict?: boolean): Moment; export function unix(timestamp: number): Moment;