mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Added more definitions for moment.js.
This commit is contained in:
+17
-8
@@ -77,6 +77,15 @@ moment().month(0).date(1).hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
moment().startOf('hour');
|
||||
moment().minutes(0).seconds(0).milliseconds(0);
|
||||
|
||||
var getMilliseconds: number = moment().milliseconds();
|
||||
var getSeconds: number = moment().seconds();
|
||||
var getMinutes: number = moment().minutes();
|
||||
var getHours: number = moment().hours();
|
||||
var getDate: number = moment().date();
|
||||
var getDay: number = moment().day();
|
||||
var getMonth: number = moment().month();
|
||||
var getYear: number = moment().year();
|
||||
|
||||
moment().sod();
|
||||
moment().hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
moment().eod();
|
||||
@@ -104,11 +113,11 @@ a6.from([2007, 0, 28]);
|
||||
a6.from(new Date(2007, 0, 28));
|
||||
a6.from("1-28-2007");
|
||||
|
||||
var a7 = moment();\n
|
||||
var a7 = moment();
|
||||
var b7 = moment("10-10-1900", "MM-DD-YYYY");
|
||||
a7.from(b7);
|
||||
|
||||
var start = moment([2007, 0, 5]);\n
|
||||
var start = moment([2007, 0, 5]);
|
||||
var end = moment([2007, 0, 10]);
|
||||
start.from(end);
|
||||
start.from(end, true);
|
||||
@@ -124,12 +133,12 @@ moment.humanizeDuration(1, "minutes", true);
|
||||
moment.humanizeDuration(-60000, true);
|
||||
moment.humanizeDuration(-1, "minutes", true);
|
||||
|
||||
var a = moment([2007, 0, 29]);
|
||||
var b = moment([2007, 0, 28]);
|
||||
a.diff(b) ;
|
||||
a.diff(b, 'days');
|
||||
a.diff(b, 'years')
|
||||
a.diff(b, 'years', true);
|
||||
var a8 = moment([2007, 0, 29]);
|
||||
var b8 = moment([2007, 0, 28]);
|
||||
a8.diff(b8) ;
|
||||
a8.diff(b8, 'days');
|
||||
a8.diff(b8, 'years')
|
||||
a8.diff(b8, 'years', true);
|
||||
|
||||
moment([2007, 0, 29]).toDate();
|
||||
moment(1318874398806).valueOf();
|
||||
|
||||
Vendored
+29
-10
@@ -57,7 +57,7 @@ interface Moment {
|
||||
format(format: string): string;
|
||||
format(): string;
|
||||
|
||||
fromNow(): string;
|
||||
fromNow(withoutSuffix?: bool): string;
|
||||
|
||||
startOf(soort: string): Moment;
|
||||
endOf(soort: string): Moment;
|
||||
@@ -78,14 +78,22 @@ interface Moment {
|
||||
|
||||
isValid(): bool;
|
||||
|
||||
year(y?: number): Moment;
|
||||
month(M?: number): Moment;
|
||||
day(d?: number): Moment;
|
||||
date(d?: number): Moment;
|
||||
hours(h?: number): Moment;
|
||||
minutes(m?: number): Moment;
|
||||
seconds(s?: number): Moment;
|
||||
milliseconds(ms?: number): Moment;
|
||||
year(y: number): Moment;
|
||||
year(): number;
|
||||
month(M: number): Moment;
|
||||
month(): number;
|
||||
day(d: number): Moment;
|
||||
day(): number;
|
||||
date(d: number): Moment;
|
||||
date(): number;
|
||||
hours(h: number): Moment;
|
||||
hours(): number;
|
||||
minutes(m: number): Moment;
|
||||
minutes(): number;
|
||||
seconds(s: number): Moment;
|
||||
seconds(): number;
|
||||
milliseconds(ms: number): Moment;
|
||||
milliseconds(): number;
|
||||
|
||||
sod(): Moment; // Start of Day
|
||||
eod(): Moment; // End of Day
|
||||
@@ -135,15 +143,26 @@ interface MomentStatic {
|
||||
utc(String: string): Moment; // parse string into UTC mode
|
||||
utc(String1: string, String2: string): Moment; // parse a string and format into UTC mode
|
||||
|
||||
isMoment(): bool;
|
||||
isMoment(m: any): bool;
|
||||
lang(language: string);
|
||||
lang(language: string, definition: any); // TODO definition
|
||||
|
||||
months: string[];
|
||||
monthsShort: string[];
|
||||
weekdays: string[];
|
||||
weekdaysShort: string[];
|
||||
weekdaysMin: string[];
|
||||
longDateFormat: any;
|
||||
relativeTime: any;
|
||||
meridiem: (hour, minute, isLower) => string;
|
||||
calendar: any;
|
||||
ordinal: (num: number) => string;
|
||||
|
||||
duration(milliseconds: Number): Duration;
|
||||
duration(num: Number, soort: string): Duration;
|
||||
duration(input: MomentInput): Duration;
|
||||
duration(object: any): Duration;
|
||||
duration(): Duration;
|
||||
}
|
||||
|
||||
declare var moment: MomentStatic;
|
||||
Reference in New Issue
Block a user