diff --git a/moment-round/index.d.ts b/moment-round/index.d.ts new file mode 100644 index 0000000000..e68181ac34 --- /dev/null +++ b/moment-round/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for moment-round 1.0 +// Project: https://github.com/WebDevTmas/moment-round +// Definitions by: Jacob Baskin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as moment from 'moment'; + +declare module 'moment' { + interface Moment { + round(precision: number, key: string, direction: 'round' | 'ceil' | 'floor'): Moment; + ceil(precision: number, key: string): Moment; + floor(precision: number, key: string): Moment; + } +} diff --git a/moment-round/moment-round-tests.ts b/moment-round/moment-round-tests.ts new file mode 100644 index 0000000000..6925966365 --- /dev/null +++ b/moment-round/moment-round-tests.ts @@ -0,0 +1,8 @@ +import * as moment from 'moment'; + +var m = new moment(); // 2015-06-18 15:30:19 +moment.round(5, 'seconds'); // 2015-06-18 15:30:20 +moment.ceil(3, 'minutes'); // 2015-06-18 15:33:00 +moment.floor(16, 'hours'); // 2015-06-18 00:00:00 +moment.ceil(21, 'hours'); // 2015-06-18 21:00:00 +moment.ceil(20, 'hours'); // 2015-06-19 00:00:00 diff --git a/moment-round/tsconfig.json b/moment-round/tsconfig.json new file mode 100644 index 0000000000..7054df992f --- /dev/null +++ b/moment-round/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "moment-round-tests.ts" + ] +} diff --git a/moment-round/tslint.json b/moment-round/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/moment-round/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" }