mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Add moment-precise-range-plugin
This commit is contained in:
28
types/moment-precise-range-plugin/index.d.ts
vendored
Normal file
28
types/moment-precise-range-plugin/index.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// Type definitions for moment-precise-range 0.2
|
||||
// Project: https://github.com/codebox/moment-precise-range
|
||||
// Definitions by: Mitchell Grice <https://github.com/gricey432>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import moment = require('moment');
|
||||
|
||||
export = moment;
|
||||
|
||||
declare module "moment" {
|
||||
interface PreciseRangeValueObject {
|
||||
years: number;
|
||||
months: number;
|
||||
days: number;
|
||||
hours: number;
|
||||
minutes: number;
|
||||
seconds: number;
|
||||
firstDateWasLater: boolean;
|
||||
}
|
||||
|
||||
interface Moment {
|
||||
preciseDiff(d2: Moment, returnValueObject?: false): string;
|
||||
preciseDiff(d2: Moment, returnValueObject: true): PreciseRangeValueObject;
|
||||
}
|
||||
|
||||
function preciseDiff(d1: Moment, d2: Moment, returnValueObject?: false): string;
|
||||
function preciseDiff(d1: Moment, d2: Moment, returnValueObject: true): PreciseRangeValueObject;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import moment = require("moment");
|
||||
import * as momentPreciseRange from "moment-precise-range-plugin";
|
||||
|
||||
// Static methods
|
||||
const m1 = moment.utc();
|
||||
const m2 = moment.utc();
|
||||
moment.preciseDiff(m1, m2);
|
||||
moment.preciseDiff(m1, m2, true);
|
||||
moment.preciseDiff(m1, m2, false);
|
||||
|
||||
// Instance methods
|
||||
m1.preciseDiff(m2);
|
||||
m1.preciseDiff(m2, true);
|
||||
m1.preciseDiff(m2, false);
|
||||
6
types/moment-precise-range-plugin/package.json
Normal file
6
types/moment-precise-range-plugin/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"moment": ">=2.14.0"
|
||||
}
|
||||
}
|
||||
23
types/moment-precise-range-plugin/tsconfig.json
Normal file
23
types/moment-precise-range-plugin/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"moment-precise-range-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/moment-precise-range-plugin/tslint.json
Normal file
1
types/moment-precise-range-plugin/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user