Merge pull request #8299 from marinewater/master

Add fromnow.d.ts
This commit is contained in:
Masahiro Wakame
2016-02-29 22:30:11 +09:00
2 changed files with 53 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
/// <reference path="fromnow.d.ts" />
import fromnow = require( 'fromnow' );
function dateOnly() {
fromnow( '2015-12-31' );
}
function maxChunks() {
fromnow( '2015-12-31', {
maxChunks: 12
});
}
function useAgo() {
fromnow( '2015-12-31', {
useAgo: true
});
}
function useAnd() {
fromnow( '2015-12-31', {
useAnd: true
});
}
+28
View File
@@ -0,0 +1,28 @@
// Type definitions for fromnow v2.0.0
// Project: https://github.com/lukeed/fromNow
// Definitions by: Martin Bukovics <https://github.com/marinewater>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module FromNow {
interface FromNowOpts {
maxChunks?: number,
useAgo?: boolean,
useAnd?: boolean
}
export interface FromNowStatic {
/**
* Get readable time differences from now vs past or future dates.
* @param {string} date
* @param {object} [opts]
* @param {number} [opts.maxChucks=10]
* @param {boolean} [opts.useAgo=false]
* @param {boolean} [opts.useAnd=false]
*/
(date: string, opts?: FromNowOpts): string
}
}
declare module 'fromnow' {
var FromNow: FromNow.FromNowStatic;
export = FromNow;
}