UNPKG

@utilify/core

Version:

Modern, strongly typed, and safe utility function library for JavaScript and TypeScript. Includes type checking, manipulation of arrays, objects, strings, dates, colors, numbers, regular expressions, and more. Compatible with Browser, Node.js, Deno, and B

12 lines 555 B
type TimeUnit = "milliseconds" | "seconds" | "minutes" | "hours" | "days" | "years"; /** * Calculates the elapsed time between two dates in the specified unit. * @param {Date} from - The start date. * @param {Date} [to=new Date()] - The end date. * @param {TimeUnit} [unit] - The unit to return. * @returns {number} The elapsed time in the specified unit. * @throws {TypeError} If dates or unit are invalid. */ export default function elapsedTime(from: Date, to?: Date, unit?: TimeUnit): number; export {}; //# sourceMappingURL=elapsedTime.d.ts.map