Relative time
Format relative dates such as tomorrow or three days ago.
The relativeTime filter delegates to Intl.RelativeTimeFormat. Its input is
an offset, not a timestamp. The unit defaults to day.
<span>{{ -1 | relativeTime:'day':'en' }}</span>
<span>{{ 2 | relativeTime:'hour':'en' }}</span>
Missing and nonnumeric values produce an empty string. Calculate the offset in the model so time-dependent updates have an explicit schedule.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.