add parse-human-date-range

This commit is contained in:
Emily Marigold Klassen 2019-04-02 11:32:02 -07:00
parent 547098699c
commit fa5fc0385f
4 changed files with 59 additions and 0 deletions

View File

@ -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 <https://github.com/forivall>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = parse;
declare function parse(input: string, offset?: Date): Date[];

View File

@ -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'));

View 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",
"parse-human-date-range-tests.ts"
]
}

View File

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