]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
[misc] Add 'ss' relative time key to typescript definition (#4246)
authorxkxx <xkxx@users.noreply.github.com>
Mon, 11 Dec 2017 00:39:36 +0000 (16:39 -0800)
committerKunal Marwaha <marwahaha@berkeley.edu>
Mon, 11 Dec 2017 00:39:36 +0000 (19:39 -0500)
* Add 'ss' to typescript definition

* add missing ss key to MomentRelativetime

* add typing tests for new ss key

* correct whitespacing issues

moment.d.ts
typing-tests/moment-tests.ts

index 24667a3f5a3187a692dc1ee8ffe6eb13ee2f99af..cdca9da0f2e08b65ddc702d221e83c6e51b49f46 100644 (file)
@@ -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;
index af635ca7cfd437e3b76ef92cb1f6e78752bd033b..bafdf117528f2bece7472aba79f376d06f2a7da4 100644 (file)
@@ -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",