mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-20 00:59:29 +08:00
Merge pull request #7586 from galtalmor/master
Updated Moment JS to version 2.11.1.
This commit is contained in:
67
moment/moment-node.d.ts
vendored
67
moment/moment-node.d.ts
vendored
@@ -1,10 +1,12 @@
|
||||
// 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 <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>, Matt Brooks <https://github.com/EnableSoftware>
|
||||
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>, Matt Brooks <https://github.com/EnableSoftware>, Gal Talmor <https://github.com/galtalmor>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module moment {
|
||||
|
||||
type MomentComparable = Moment | string | number | Date | number[];
|
||||
|
||||
interface MomentDateObject {
|
||||
years?: number;
|
||||
/* One digit */
|
||||
@@ -115,6 +117,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;
|
||||
@@ -259,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;
|
||||
@@ -284,15 +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;
|
||||
|
||||
// Deprecated as of 2.8.0.
|
||||
/**
|
||||
* @since 2.10.7+
|
||||
*/
|
||||
isSameOrBefore(b: MomentComparable, granularity?: string): boolean;
|
||||
|
||||
/**
|
||||
* @deprecated since version 2.8.0
|
||||
*/
|
||||
lang(language: string): Moment;
|
||||
lang(reset: boolean): Moment;
|
||||
lang(): MomentLanguage;
|
||||
@@ -305,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;
|
||||
|
||||
@@ -317,9 +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 2.10.7+
|
||||
*/
|
||||
creationData(): MomentCreationData;
|
||||
}
|
||||
|
||||
type formatFunction = () => string;
|
||||
@@ -426,7 +458,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;
|
||||
|
||||
@@ -479,6 +513,11 @@ declare module moment {
|
||||
relativeTimeThreshold(threshold: string): number | boolean;
|
||||
relativeTimeThreshold(threshold: string, limit: number): boolean;
|
||||
|
||||
/**
|
||||
* @since 2.10.7+
|
||||
*/
|
||||
now(): number;
|
||||
|
||||
/**
|
||||
* Constant used to enable explicit ISO_8601 format parsing.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user