UNPKG

670 BTypeScriptView Raw
1/**
2 * The namespace for date functions.
3 */
4export declare namespace Time {
5 type HumanStyle = Intl.ResolvedRelativeTimeFormatOptions['style'];
6 /**
7 * Convert a timestring to a human readable string (e.g. 'two minutes ago').
8 *
9 * @param value - The date timestring or date object.
10 *
11 * @returns A formatted date.
12 */
13 function formatHuman(value: string | Date, format?: HumanStyle): string;
14 /**
15 * Convenient helper to convert a timestring to a date format.
16 *
17 * @param value - The date timestring or date object.
18 *
19 * @returns A formatted date.
20 */
21 function format(value: string | Date): string;
22}