UNPKG

@technobuddha/library

Version:
21 lines (20 loc) 851 B
export declare type Options = { /** Describe the time difference as a time on a nearby day */ todayTomorrowYesterday?: boolean; /** Passed to {@link formatDate} to display a time */ timeFormat?: string; /** Passed to {@link formatSate} to display a year, month and day */ ymdFormat?: string; /** Passed to {@link formatDate} to dislay a month and day */ mdFormat?: string; }; /** * Describe the difference between two dates in a simple format * * @param input The date * @param relativeTo The date to compare to * @param __namedParameters see {@link Options} * @returns string describing the time difference between the two dates */ export declare function relativeTime(input: Date, relativeTo: Date, { todayTomorrowYesterday, timeFormat, ymdFormat, mdFormat, }?: Options): string; export default relativeTime;