mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Define types for subtract method and add tests for it (#20617)
This commit is contained in:
parent
9266e419ed
commit
bc2da03e91
@ -9,3 +9,13 @@ dateArithmetic.add(new Date(2010, 7, 23), 2, 'month');
|
||||
dateArithmetic.add(new Date(2010, 7, 23), 2, 'year');
|
||||
dateArithmetic.add(new Date(2010, 7, 23), 2, 'decade');
|
||||
dateArithmetic.add(new Date(2010, 7, 23), 2, 'century');
|
||||
|
||||
dateArithmetic.subtract(new Date(2010, 7, 30), 1, 'second');
|
||||
dateArithmetic.subtract(new Date(2010, 7, 29), 2, 'minutes');
|
||||
dateArithmetic.subtract(new Date(2010, 7, 28), 3, 'hours');
|
||||
dateArithmetic.subtract(new Date(2010, 7, 27), 4, 'day');
|
||||
dateArithmetic.subtract(new Date(2010, 7, 26), 5, 'week');
|
||||
dateArithmetic.subtract(new Date(2010, 7, 24), 6, 'month');
|
||||
dateArithmetic.subtract(new Date(2010, 7, 23), 7, 'year');
|
||||
dateArithmetic.subtract(new Date(2010, 7, 22), 8, 'decade');
|
||||
dateArithmetic.subtract(new Date(2010, 7, 21), 9, 'century');
|
||||
|
||||
5
types/date-arithmetic/index.d.ts
vendored
5
types/date-arithmetic/index.d.ts
vendored
@ -7,8 +7,11 @@ type Unit = 'second' | 'minutes' | 'hours' | 'day' | 'week' | 'month' | 'year' |
|
||||
|
||||
/** dateArithmetic Public Instance Methods */
|
||||
interface dateArithmeticStatic {
|
||||
/** Add specified amount of units to a provided date and return new date as a result */
|
||||
/** Add specified amount of units to a provided date and return new date as a result */
|
||||
add(date: Date, num: number, unit: Unit): Date;
|
||||
|
||||
/** Subtract specified amount of units from a provided date and return new date as a result */
|
||||
subtract(date: Date, num: number, unit: Unit): Date;
|
||||
}
|
||||
|
||||
declare module 'dateArithmetic' {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user