Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

How far away

Use the relative form for a moment within a week of now, and the date beyond that.

Past and future
Pass an ISO 8601 string with Z or an offset (DateTimeOffset.ToString("o")); a string without a zone is read as UTC. A bare date such as 2026-10-04 is midnight IST, so it reads as hours ago on that day; use a full instant when the time matters.
Show code
<app-relative-time value="@invoice.CreatedDateTimeUtc.ToString("o")"></app-relative-time>

Every option

Every value of every prop, one cell each.

value: the forms it takes

value: an ISO string with Z
value: an ISO string with an offset
value: a bare date, midnight IST
value: epoch milliseconds, React only
value: a Date, React only
value: unreadable, shows a dash

tooltipPlacement: the side of the tooltip

tooltip-placement="auto" (default)
tooltip-placement="top"
tooltip-placement="bottom"
tooltip-placement="start"
tooltip-placement="end"

className: an extra class

className (React only): adds a class, no visible change

Guidance

What to do, and what to avoid.

Use it when

  • When something happened: created, updated, last seen, last active.
  • Feeds, activity logs and list rows.

Reach for something else when

  • A date that is itself the fact (due date, invoice date, joining date). → a date column, or formatDate
  • A countdown that must tick every second. → A purpose-built timer

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

auto top bottom start end
React, generated from the controls
<AppRelativeTime value="2026-11-16T23:36:34Z" />
Razor, the same props
<app-relative-time value="2026-11-16T23:36:34Z"></app-relative-time>

2 props. The 2 most used come first.

Used on most screens 2 props

PropTypeDefaultDescription
valuedefault - string - The moment as an ISO string with its zone (Z or an offset) or epoch milliseconds; write a Date as an ISO string. A bare 2026-10-04 is midnight IST; a missing or unreadable value shows a dash and no tooltip.
tooltip-placementdefault auto auto | top | bottom | start | end auto Preferred side of the exact-time tooltip.

Screen reader

3 notes
  • It renders a time element whose dateTime attribute holds the machine-readable value, so the exact moment stays in the page.
  • The exact IST time shows in a tooltip on hover.
  • An unreadable or missing value shows a dash and no tooltip.