UNPKG

@toreda/time

Version:

Simple, small footprint library for common time operations and converting between units of time.

13 lines (12 loc) 600 B
import type { Time } from '../time'; import type { TimeUnit } from './unit'; /** * Time remaining until `time`. Negative when `time` is already in the past. * Numbers are interpreted as a unix timestamp in seconds. The returned Time * uses `units` (defaults to seconds). Returns null when input is invalid or * the computed result falls outside the safe integer range. * * @param time Target Time instance, or unix timestamp in seconds. * @param units Units for the returned Time. Defaults to `'s'`. */ export declare function timeUntil(time: Time | number, units?: TimeUnit): Time | null;