Time Ago
Relative time display that auto-updates ("3 minutes ago", "yesterday").
<arc-time-ago>Overview
TimeAgo shows how far a date is from now, as in "3 minutes ago", "yesterday" or "in 2 hours". datetime takes an ISO 8601 string, or anything new Date() can parse. The text is recalculated every minute while the date is within an hour, every 5 minutes within a day, and every hour after that. Set live="false" to stop the updates.
It renders a <time> element that keeps the exact datetime attribute, with the full formatted date in title for hover. Formatting uses Intl.RelativeTimeFormat, so locale="de-DE" gives "vor 3 Minuten". Under a minute it shows "just now", in English whatever the locale.
Guidelines
Do
- Use it for timestamps in feeds, comments, commit logs and activity streams
- Pass a valid ISO 8601 string in `datetime`
- Set `live="false"` for printed reports or export previews
- Set `locale` to your app's locale
Don't
- Don't use it as a countdown with second-level precision. Use CountdownTimer
- Don't pass a date `new Date()` can't parse. An invalid date renders nothing
- Don't make it the only date shown where the exact time matters, such as legal or financial records. The full date is only in the hover title
- Don't use it when you need a fixed format such as "Feb 16, 2026". Format the date yourself
Features
- Set in `--font-mono`, with the size and color of the surrounding text
Preview
Usage
This component needs JavaScript. Use the Web Component or a framework wrapper.
<arc-time-ago datetime="2026-02-16T10:30:00Z"></arc-time-ago>
<!-- Future date -->
<arc-time-ago datetime="2026-02-17T08:00:00Z"></arc-time-ago>
<!-- Static (no live updates) -->
<arc-time-ago datetime="2025-06-15" live="false"></arc-time-ago>
<!-- German locale -->
<arc-time-ago datetime="2026-02-16T10:30:00Z" locale="de-DE"></arc-time-ago>import { TimeAgo } from '@arclux/arc-ui-react';
export default function Example() {
return (
<>
<TimeAgo datetime="2026-02-16T10:30:00Z" />
{/* Future date */}
<TimeAgo datetime="2026-02-17T08:00:00Z" />
{/* Static snapshot */}
<TimeAgo datetime="2025-06-15" live={false} />
</>
);
}<script setup>
import { TimeAgo } from '@arclux/arc-ui-vue';
</script>
<template>
<TimeAgo datetime="2026-02-16T10:30:00Z" />
<TimeAgo datetime="2026-02-17T08:00:00Z" />
<TimeAgo datetime="2025-06-15" :live="false" />
</template><script>
import { TimeAgo } from '@arclux/arc-ui-svelte';
</script>
<TimeAgo datetime="2026-02-16T10:30:00Z" />
<TimeAgo datetime="2026-02-17T08:00:00Z" />
<TimeAgo datetime="2025-06-15" live={false} />import { Component } from '@angular/core';
import { TimeAgo } from '@arclux/arc-ui-angular';
@Component({
imports: [TimeAgo],
template: `
<arc-time-ago datetime="2026-02-16T10:30:00Z" />
<arc-time-ago datetime="2026-02-17T08:00:00Z" />
<arc-time-ago datetime="2025-06-15" [live]="false" />
`,
})
export class MyComponent {}import { TimeAgo } from '@arclux/arc-ui-solid';
export default function Example() {
return (
<>
<TimeAgo datetime="2026-02-16T10:30:00Z" />
<TimeAgo datetime="2026-02-17T08:00:00Z" />
<TimeAgo datetime="2025-06-15" live={false} />
</>
);
}import { TimeAgo } from '@arclux/arc-ui-preact';
export default function Example() {
return (
<>
<TimeAgo datetime="2026-02-16T10:30:00Z" />
<TimeAgo datetime="2026-02-17T08:00:00Z" />
<TimeAgo datetime="2025-06-15" live={false} />
</>
);
}API
datetimestring''- ISO 8601 date string or any value parseable by new Date().
localestring'en-US'- BCP 47 locale tag for Intl.RelativeTimeFormat output.
livebooleantrue- Auto-update the relative time on an adaptive interval.