mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
@@ -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
|
||||
});
|
||||
}
|
||||
Vendored
+28
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user