@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
14 lines (13 loc) • 498 B
JavaScript
export function durationUntilString(start, end, largestUnit, options) {
const duration = start.until(end, {
largestUnit,
smallestUnit: options?.smallestUnit,
roundingIncrement: options?.roundingIncrement,
roundingMode: options?.roundingMode,
});
return duration.toString({
smallestUnit: options?.toStringSmallestUnit,
fractionalSecondDigits: options?.fractionalSecondDigits,
roundingMode: options?.toStringRoundingMode,
});
}