From: xkxx Date: Mon, 11 Dec 2017 00:39:36 +0000 (-0800) Subject: [misc] Add 'ss' relative time key to typescript definition (#4246) X-Git-Tag: 2.19.4~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61efe0aca839c83016a2b5ae599063bde51cd09e;p=thirdparty%2Fmoment.git [misc] Add 'ss' relative time key to typescript definition (#4246) * Add 'ss' to typescript definition * add missing ss key to MomentRelativetime * add typing tests for new ss key * correct whitespacing issues --- diff --git a/moment.d.ts b/moment.d.ts index 24667a3f5..cdca9da0f 100644 --- a/moment.d.ts +++ b/moment.d.ts @@ -2,7 +2,7 @@ declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSp declare function moment(inp?: moment.MomentInput, format?: moment.MomentFormatSpecification, language?: string, strict?: boolean): moment.Moment; declare namespace moment { - type RelativeTimeKey = 's' | 'm' | 'mm' | 'h' | 'hh' | 'd' | 'dd' | 'M' | 'MM' | 'y' | 'yy'; + type RelativeTimeKey = 's' | 'ss' | 'm' | 'mm' | 'h' | 'hh' | 'd' | 'dd' | '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'; @@ -82,6 +82,7 @@ declare namespace moment { future: RelativeTimeFuturePastVal; past: RelativeTimeFuturePastVal; s: RelativeTimeSpecVal; + ss: RelativeTimeSpecVal; m: RelativeTimeSpecVal; mm: RelativeTimeSpecVal; h: RelativeTimeSpecVal; @@ -215,6 +216,7 @@ declare namespace moment { future: any; past: any; s: any; + ss: any; m: any; mm: any; h: any; @@ -408,7 +410,7 @@ declare namespace moment { strict?: boolean; } - interface Moment extends Object{ + interface Moment extends Object { format(format?: string): string; startOf(unitOfTime: unitOfTime.StartOf): Moment; diff --git a/typing-tests/moment-tests.ts b/typing-tests/moment-tests.ts index af635ca7c..bafdf1175 100644 --- a/typing-tests/moment-tests.ts +++ b/typing-tests/moment-tests.ts @@ -302,6 +302,7 @@ moment.locale('en', { future: "in %s", past: "%s ago", s: "seconds", + ss: "%d seconds", m: "a minute", mm: "%d minutes", h: "an hour", @@ -446,6 +447,7 @@ moment.locale('en', { future: "in %s", past: "%s ago", s: "seconds", + ss: "%d seconds", m: "a minute", mm: "%d minutes", h: "an hour",