ComponentsUtilities

Relative Time

"5 minutes ago", "yesterday", "in 3 days" — a date said relative to now in the tectra locale.

Part of @tectra-ng/utils (npm install @tectra-ng/utils, also included in tectra-ng).

Features4APIThemingAccessibility

Basic

Within a day the pipe counts minutes and hours; past midnight it switches to calendar days, then months and years.

Deploy finished now
Comment added 7 minutes ago
Report scheduled tomorrow
Invoice paid 2 days ago
Trial ends in 12 days
Account created last year

Options

granularity: 'day' speaks in days only, largestUnit stops at days or months, numeric: 'always' drops "yesterday" for "1 day ago", style shortens the units.

default2 hours agoyesterdaylast month
granularity: 'day'todayyesterdaylast month
largestUnit: 'day'2 hours agoyesterday45 days ago
numeric: 'always'2 hours ago1 day ago1 month ago
style: 'short'2 hr. ago1 day ago1 mo. ago

Live

Pass now from a ticking signal and the text keeps up: post a message and watch it age. In an app TxClock.now is that signal.

Nothing posted yet.

Locale

The pipe follows the tectra locale — this example has its own TxLocaleService, so switching it here leaves the rest of the site alone. Pass locale for a single value.

Updated 3 days agoAlways in Polish: 3 dni temu