Skip to content

Commit

Permalink
[misc] Add 'ss' relative time key to typescript definition (moment#4246)
Browse files Browse the repository at this point in the history
* Add 'ss' to typescript definition

* add missing ss key to MomentRelativetime

* add typing tests for new ss key

* correct whitespacing issues
  • Loading branch information
xkxx authored and marwahaha committed Dec 11, 2017
1 parent 1c978ba commit 61efe0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions moment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -82,6 +82,7 @@ declare namespace moment {
future: RelativeTimeFuturePastVal;
past: RelativeTimeFuturePastVal;
s: RelativeTimeSpecVal;
ss: RelativeTimeSpecVal;
m: RelativeTimeSpecVal;
mm: RelativeTimeSpecVal;
h: RelativeTimeSpecVal;
Expand Down Expand Up @@ -215,6 +216,7 @@ declare namespace moment {
future: any;
past: any;
s: any;
ss: any;
m: any;
mm: any;
h: any;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions typing-tests/moment-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 61efe0a

Please sign in to comment.