Merge pull request #14277 from jacobbaskin/moment-round

Typings for moment-round
This commit is contained in:
Daniel Rosenwasser
2017-01-26 12:43:55 -08:00
committed by GitHub
5 changed files with 50 additions and 0 deletions

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

@@ -0,0 +1,16 @@
// 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';
export = 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 = moment();
m.round(5, 'seconds');
m.ceil(3, 'minutes');
m.floor(16, 'hours');
m.ceil(21, 'hours');
m.ceil(20, 'hours');

View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"moment": ">=2.14.0"
}
}

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