From 4cdea2aaeb4a26873828d463c97dc36fad8d85d6 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Tue, 12 Jan 2016 15:37:58 +0200 Subject: [PATCH 1/4] Updated to version 2.11.1. Added now function in MomentStatic. Added isSameOrBefore and creationData in Moment. --- moment/moment-node.d.ts | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 3471a8fc30..99c32854af 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Moment.js 2.10.5 +// Type definitions for Moment.js 2.11.1 // Project: https://github.com/timrwood/moment -// Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya , Matt Brooks +// Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi , Dick van den Brink , Adi Dahiya , Matt Brooks , Gal Talmor // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module moment { @@ -115,6 +115,18 @@ declare module moment { toJSON(): string; } + interface MomentLocale { + ordinal(n: number): string; + } + + interface MomentCreationData { + input?: string, + format?: string, + locale: MomentLocale, + isUTC: boolean, + strict?: boolean + } + interface Moment { format(format: string): string; format(): string; @@ -292,6 +304,9 @@ declare module moment { isSame(b: Moment | string | number | Date | number[], granularity?: string): boolean; isBetween(a: Moment | string | number | Date | number[], b: Moment | string | number | Date | number[], granularity?: string): boolean; + // Since version 2.10.7+ + isSameOrBefore(b: Moment | string | number | Date | number[], granularity?: string); + // Deprecated as of 2.8.0. lang(language: string): Moment; lang(reset: boolean): Moment; @@ -317,9 +332,12 @@ declare module moment { set(unit: string, value: number): Moment; set(objectLiteral: MomentInput): Moment; - /*This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds.*/ - //Works with version 2.10.5+ + /* This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds. */ + // Works with version 2.10.5+ toObject(): MomentDateObject; + + // Since version 2.10.7+ + creationData(): MomentCreationData; } type formatFunction = () => string; @@ -479,6 +497,9 @@ declare module moment { relativeTimeThreshold(threshold: string): number | boolean; relativeTimeThreshold(threshold: string, limit: number): boolean; + // Since version 2.10.7+ + now(): number; + /** * Constant used to enable explicit ISO_8601 format parsing. */ From ba4191f9dded38121c981d7989928da435a29aa6 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Tue, 12 Jan 2016 16:17:07 +0200 Subject: [PATCH 2/4] Updated to version 2.11.1. Added now function in MomentStatic. Added isSameOrBefore and creationData in Moment. --- moment/moment-node.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 99c32854af..89178262f9 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -305,7 +305,7 @@ declare module moment { isBetween(a: Moment | string | number | Date | number[], b: Moment | string | number | Date | number[], granularity?: string): boolean; // Since version 2.10.7+ - isSameOrBefore(b: Moment | string | number | Date | number[], granularity?: string); + isSameOrBefore(b: Moment | string | number | Date | number[], granularity?: string): boolean; // Deprecated as of 2.8.0. lang(language: string): Moment; From fc129dfe1ac8805399121feb406de91c9572b3f8 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Tue, 12 Jan 2016 17:51:02 +0200 Subject: [PATCH 3/4] Updated to version 2.11.1. Added now function in MomentStatic. Added isSameOrBefore and creationData in Moment. --- moment/moment-node.d.ts | 51 ++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 89178262f9..6102d1e132 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -5,6 +5,8 @@ declare module moment { + type MomentComparable = Moment | string | number | Date | number[]; + interface MomentDateObject { years?: number; /* One digit */ @@ -271,8 +273,8 @@ declare module moment { dayOfYear(): number; dayOfYear(d: number): Moment; - from(f: Moment | string | number | Date | number[], suffix?: boolean): string; - to(f: Moment | string | number | Date | number[], suffix?: boolean): string; + from(f: MomentComparable, suffix?: boolean): string; + to(f: MomentComparable, suffix?: boolean): string; toNow(withoutPrefix?: boolean): string; diff(b: Moment): number; @@ -296,18 +298,22 @@ declare module moment { isDST(): boolean; isBefore(): boolean; - isBefore(b: Moment | string | number | Date | number[], granularity?: string): boolean; + isBefore(b: MomentComparable, granularity?: string): boolean; isAfter(): boolean; - isAfter(b: Moment | string | number | Date | number[], granularity?: string): boolean; + isAfter(b: MomentComparable, granularity?: string): boolean; - isSame(b: Moment | string | number | Date | number[], granularity?: string): boolean; - isBetween(a: Moment | string | number | Date | number[], b: Moment | string | number | Date | number[], granularity?: string): boolean; + isSame(b: MomentComparable, granularity?: string): boolean; + isBetween(a: MomentComparable, b: MomentComparable, granularity?: string): boolean; - // Since version 2.10.7+ - isSameOrBefore(b: Moment | string | number | Date | number[], granularity?: string): boolean; + /** + * @since 2.10.7+ + */ + isSameOrBefore(b: MomentComparable, granularity?: string): boolean; - // Deprecated as of 2.8.0. + /** + * @deprecated since version 2.8.0 + */ lang(language: string): Moment; lang(reset: boolean): Moment; lang(): MomentLanguage; @@ -320,11 +326,15 @@ declare module moment { localeData(reset: boolean): Moment; localeData(): MomentLanguage; - // Deprecated as of 2.7.0. + /** + * @deprecated since version 2.7.0 + */ max(date: Moment | string | number | Date | any[]): Moment; max(date: string, format: string): Moment; - // Deprecated as of 2.7.0. + /** + * @deprecated since version 2.7.0 + */ min(date: Moment | string | number | Date | any[]): Moment; min(date: string, format: string): Moment; @@ -332,11 +342,16 @@ declare module moment { set(unit: string, value: number): Moment; set(objectLiteral: MomentInput): Moment; - /* This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds. */ - // Works with version 2.10.5+ + /** + * This returns an object containing year, month, day-of-month, hour, minute, seconds, milliseconds. + * @since 2.10.5+ + */ toObject(): MomentDateObject; - // Since version 2.10.7+ + /** + * @since 2.10.7+ + */ + creationData(): MomentCreationData; } @@ -444,7 +459,9 @@ declare module moment { isDuration(): boolean; isDuration(d: any): boolean; - // Deprecated in 2.8.0. + /** + * @deprecated since version 2.8.0 + */ lang(language?: string): string; lang(language?: string, definition?: MomentLanguage): string; @@ -497,7 +514,9 @@ declare module moment { relativeTimeThreshold(threshold: string): number | boolean; relativeTimeThreshold(threshold: string, limit: number): boolean; - // Since version 2.10.7+ + /** + * @since 2.10.7+ + */ now(): number; /** From 8aacd9222c7e36171adb3dfbd6178a90965d91d8 Mon Sep 17 00:00:00 2001 From: Gal Talmor Date: Tue, 12 Jan 2016 18:02:48 +0200 Subject: [PATCH 4/4] Updated to version 2.11.1. Added now function in MomentStatic. Added isSameOrBefore and creationData in Moment. --- moment/moment-node.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 6102d1e132..a11fad1dc6 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -351,7 +351,6 @@ declare module moment { /** * @since 2.10.7+ */ - creationData(): MomentCreationData; }