Timestamp
On this page
Overview
Provides locale-aware date and time formatting for consistent display
across pages. Renders a <time> element with an ARIA-accessible
datetime attribute for screen readers. Authors must set date
when displaying a specific moment; when omitted, the current time
is used. Authors should wrap relative timestamps in rh-tooltip
so users can see the full date. Avoid combining date-format and
time-format with customFormat as customFormat overrides both.
The element is not keyboard-focusable on its own.
Edit element properties
import '@rhds/elements/rh-timestamp/rh-timestamp.js';
<rh-timestamp date="Tue Aug 09 2006 14:57:00 GMT-0400"></rh-timestamp>
import { Timestamp } from "@rhds/elements/react/rh-timestamp/rh-timestamp.js";
// NOTE: React 19+ does not require these wrapper imports.
// You can use the custom elements directly as-is.
export const Demo = () => (
<Timestamp date="Tue Aug 09 2006 14:57:00 GMT-0400" />
);
Sets the date formatting style. When set without time-format, only the
date portion is displayed. Accepts full, long, medium, or short.
See MDN for details on each style.
Sets the time formatting style. When set without date-format, only the
time portion is displayed. Accepts full, long, medium, or short.
See MDN for details on each style.
Appends custom text after the formatted timestamp string. Useful for displaying a timezone label (e.g. "US Eastern") when the built-in time format does not include one.
Overrides the browser's default locale for formatting. Accepts any valid BCP 47 language tag (e.g. "en-GB", "es", "ja"). Defaults to the browser's locale when not set.
When set, displays the timestamp as a relative time string
(e.g. "3 hours ago", "in 2 days") instead of an absolute date.
Uses Intl.RelativeTimeFormat for locale-aware output.
When set, converts the displayed time to UTC. If no display-suffix
is provided, "UTC" is automatically appended.
When set, uses 12-hour time format (e.g. "2:30 PM") instead of 24-hour time (e.g. "14:30"). Accepts the attribute values "true" or "false", or can be set as a boolean property.
The date value to display, as a date string parseable by new Date().
If not set, defaults to the current date and time. When read, returns
the locale-formatted string representation of the date.
Status
- Figma library:
-
Ready - RH Elements:
-
Ready - RH Shared Libs:
-
Ready
When to use
- When you need to customize date and time content
Status checklist
| Property | Status | Meaning |
|---|---|---|
| Figma library |
|
Component is available in the Figma library |
| RH Elements |
|
Component is available in RH Elements |
| RH Shared Libs |
|
Component is available in RH Shared Libs |
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.