Add typings for moment-round

This commit is contained in:
Jacob Baskin
2017-01-26 14:32:36 -05:00
parent 6f0270ef4c
commit 66d3bd4a3c
4 changed files with 43 additions and 0 deletions

14
moment-round/index.d.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
// Type definitions for moment-round 1.0
// Project: https://github.com/WebDevTmas/moment-round
// Definitions by: Jacob Baskin <https://github.com/jacobbaskin>
// 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;
}
}

View File

@@ -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

View File

@@ -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"
]
}

1
moment-round/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "../tslint.json" }