adur.subtract(1).days();
adur.subtract(1, 'd').days();
+var calendarFormat = {
+ sameDay: '[Today]',
+ nextDay: '[Tomorrow]',
+ nextWeek: 'dddd',
+ lastDay: '[Yesterday]',
+ lastWeek: '[Last] dddd',
+ sameElse: 'DD/MM/YYYY'
+};
+moment().calendar();
+moment().calendar(null);
+moment().calendar(calendarFormat);
+moment().calendar(null, calendarFormat);
+
// Selecting a language
moment.locale();
moment.locale('en');
hh: "%d hours",
d: "a day",
dd: "%d days",
+ w: "%d weeks",
M: "a month",
MM: "%d months",
y: "a year",
declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, language?: string, strict?: boolean): moment.Moment;
declare namespace moment {
- type RelativeTimeKey = 's' | 'ss' | 'm' | 'mm' | 'h' | 'hh' | 'd' | 'dd' | 'M' | 'MM' | 'y' | 'yy';
+ type RelativeTimeKey = 's' | 'ss' | 'm' | 'mm' | 'h' | 'hh' | 'd' | 'dd' | 'w' | 'M' | 'MM' | 'y' | 'yy';
type CalendarKey = 'sameDay' | 'nextDay' | 'lastDay' | 'nextWeek' | 'lastWeek' | 'sameElse' | string;
type LongDateFormatKey = 'LTS' | 'LT' | 'L' | 'LL' | 'LLL' | 'LLLL' | 'lts' | 'lt' | 'l' | 'll' | 'lll' | 'llll';
hh?: RelativeTimeSpecVal;
d?: RelativeTimeSpecVal;
dd?: RelativeTimeSpecVal;
+ w?: RelativeTimeSpecVal;
M?: RelativeTimeSpecVal;
MM?: RelativeTimeSpecVal;
y?: RelativeTimeSpecVal;
*/
subtract(unit: unitOfTime.DurationConstructor, amount: number|string): Moment;
+ calendar(): string;
+ calendar(formats: CalendarSpec): string;
calendar(time?: MomentInput, formats?: CalendarSpec): string;
clone(): Moment;
adur.subtract(1).days();
adur.subtract(1, 'd').days();
+var calendarFormat = {
+ sameDay: '[Today]',
+ nextDay: '[Tomorrow]',
+ nextWeek: 'dddd',
+ lastDay: '[Yesterday]',
+ lastWeek: '[Last] dddd',
+ sameElse: 'DD/MM/YYYY'
+};
+moment().calendar();
+moment().calendar(null);
+moment().calendar(calendarFormat);
+moment().calendar(null, {
+ sameDay: '[Today]',
+ nextDay: '[Tomorrow]',
+ nextWeek: 'dddd',
+ lastDay: '[Yesterday]',
+ lastWeek: '[Last] dddd',
+ sameElse: 'DD/MM/YYYY'
+});
+
// Selecting a language
moment.locale();
moment.locale('en');
hh: "%d hours",
d: "a day",
dd: "%d days",
+ w: "%d weeks",
M: "a month",
MM: "%d months",
y: "a year",