Returns a human-readable string describing how far a given date is from today.
The Date object to compare with today.
A relative time string like 'today', 'tomorrow', 'yesterday', or 'X days ago' / 'in X days'.
formatRelative(new Date()); // 'today'formatRelative(new Date(Date.now() + 86400000)); // 'tomorrow'formatRelative(new Date(Date.now() - 2 * 86400000)); // '2 days ago' Copy
formatRelative(new Date()); // 'today'formatRelative(new Date(Date.now() + 86400000)); // 'tomorrow'formatRelative(new Date(Date.now() - 2 * 86400000)); // '2 days ago'
Returns a human-readable string describing how far a given date is from today.