@tempots/ui
makeRelativeTimeSignal() function
Creates a signal that computes a human-readable relative time string between a target date and a reference date.
Signature:
makeRelativeTimeSignal: (date: Value<Date>, options?: {
now?: Value<Date>;
frequency?: number;
}) => import('@tempots/dom').Computed<string>
Parameters
Parameter |
Type |
Description |
---|---|---|
date |
Value<Date> |
The target date to compare |
options |
{ now?: Value<Date>; frequency?: number; } |
(Optional) Configuration options |
Returns: import('@tempots/dom').Computed<string>
A signal containing a human-readable relative time string (e.g., "2 minutes ago", "in 3 hours"). The signal will clean up its resources when disposed.