feat: add type definitions for easydate

This commit is contained in:
Satya Rohith
2019-03-08 11:16:59 +05:30
parent 74f644e069
commit 75a3655fa5
4 changed files with 50 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
import easydate = require('easydate');
easydate('d/M/Y');
easydate('Y-d-M', {adjust: true, timeZone: 'local'});
easydate('d-M-Y @ h:m', '2015-11-03T16:06:00.000Z');
easydate('Y-d-M', {
adjust: true,
timeZone: 'utc',
setDate: '2015-11-03T16:06:00.000Z'
});

14
types/easydate/index.d.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
// Type definitions for easydate 2.2
// Project: https://github.com/roryrjb/easydate
// Definitions by: Satya Rohith <https://github.com/satyarohith>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = easydate;
interface DateConfig {
setDate?: string;
timeZone?: 'utc' | 'local';
adjust?: boolean;
}
declare function easydate(pattern: string, config?: DateConfig | string): string;

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",
"easydate-tests.ts"
]
}

View File

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