UNPKG

nhb-toolbox

Version:

A versatile collection of smart, efficient, and reusable utility functions and classes for everyday development needs.

19 lines 1.16 kB
import type { ChronosInput, TimeUnit } from '../types'; type MainChronos = typeof import('../Chronos').Chronos; declare module '../Chronos' { interface Chronos { /** * @instance Returns full time difference from now (or a specified time) down to a given level. * * @param level Determines the smallest unit to include in the output (e.g., 'minute' will show up to minutes, ignoring seconds). Defaults to `minute`. * @param withSuffixPrefix If `true`, adds `"in"` or `"ago"` depending on whether the time is in the future or past. Defaults to `true`. * @param time An optional time value to compare with (`string`, `number`, `Date`, or `Chronos` instance). Defaults to `now`. * @returns The difference as a human-readable string, e.g., `2 years 1 month 9 days 18 hours 56 minutes ago`. */ fromNow(level: Exclude<TimeUnit, 'millisecond'>, withSuffixPrefix: boolean, time?: ChronosInput): string; } } /** * Plugin to inject `fromNow` method */ export declare const fromNowPlugin: (ChronosClass: MainChronos) => void; export {}; //# sourceMappingURL=fromNowPlugin.d.ts.map