Timestamp
Importing
Add rh-timestamp to your page with this import statement:
<script type="module">
  import '@rhds/elements/rh-timestamp/rh-timestamp.js';
</script>To learn more about installing RHDS elements on your site using an import map read our getting started docs.
Usage
<rh-timestamp date="Tue Aug 09 2006 14:57:00 GMT-0400"></rh-timestamp>
<script type="module">
  import '@rhds/elements/rh-timestamp/rh-timestamp.js';
</script>rh-timestamp
A timestamp provides consistent formats for displaying date and time values.
| Attribute | DOM Property | Description | Type | Default | 
|---|---|---|---|---|
| date-format | dateFormat | Custom date formatting style. See MDN for options. |  |  | 
| time-format | timeFormat | Custom time formatting style. See MDN for options. |  |  | 
| display-suffix | displaySuffix | Text to display after the timestamp |  |  | 
| locale | locale | Overrides the runtime's default locale |  |  | 
| relative | relative | Formats a timestamp in realtive terms |  |  | 
| utc | utc | Sets the timezone as UTC |  |  | 
| hour-12 | hour12 | Whether to use 12-hour time (as opposed to 24-hour time) |  |  | 
| date | date | A string value representing a date |  |  |