Skip to main content

formatRelativeTime

Datalayer Core


Datalayer Core / formatRelativeTime

Function: formatRelativeTime()

formatRelativeTime(value?, now?): string | undefined

Defined in: src/utils/Date.ts:78

Format a timestamp into a compact relative string.

Examples: "just now", "15m ago", "3h ago", "2d ago", "4w ago", "1y ago".

Parameters

value?

string | number | Date

now?

Date = ...

Returns

string | undefined