diff --git a/types/parse-human-date-range/index.d.ts b/types/parse-human-date-range/index.d.ts new file mode 100644 index 0000000000..3310f445ac --- /dev/null +++ b/types/parse-human-date-range/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for parse-human-date-range 1.0 +// Project: https://github.com/niksy/parse-human-date-range#readme +// Definitions by: Emily Marigold Klassen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = parse; + +declare function parse(input: string, offset?: Date): Date[]; diff --git a/types/parse-human-date-range/parse-human-date-range-tests.ts b/types/parse-human-date-range/parse-human-date-range-tests.ts new file mode 100644 index 0000000000..819542ac96 --- /dev/null +++ b/types/parse-human-date-range/parse-human-date-range-tests.ts @@ -0,0 +1,27 @@ +import parse = require('parse-human-date-range'); + +parse('last 2 days'); +/* [ + Sat Oct 15 2016 14:00:00 GMT+0200 (CEST), + Sun Oct 16 2016 14:00:00 GMT+0200 (CEST) +] */ + +parse('next 2 weeks'); +/* [ + Tue Oct 18 2016 14:00:00 GMT+0200 (CEST), + Wed Oct 19 2016 14:00:00 GMT+0200 (CEST), + Thu Oct 20 2016 14:00:00 GMT+0200 (CEST), + Fri Oct 21 2016 14:00:00 GMT+0200 (CEST), + Sat Oct 22 2016 14:00:00 GMT+0200 (CEST), + Sun Oct 23 2016 14:00:00 GMT+0200 (CEST), + Mon Oct 24 2016 14:00:00 GMT+0200 (CEST), + ... +] */ + +parse('last 2 tuesdays'); +/* [ + Tue Oct 04 2016 14:00:00 GMT+0200 (CEST), + Tue Oct 11 2016 14:00:00 GMT+0200 (CEST) +] */ + +parse('invalid', new Date('2016-10-17T12:00:00.000Z')); diff --git a/types/parse-human-date-range/tsconfig.json b/types/parse-human-date-range/tsconfig.json new file mode 100644 index 0000000000..82845bdb2f --- /dev/null +++ b/types/parse-human-date-range/tsconfig.json @@ -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", + "parse-human-date-range-tests.ts" + ] +} diff --git a/types/parse-human-date-range/tslint.json b/types/parse-human-date-range/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/parse-human-date-range/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }