Timestamp

Material Design 3-styled timestamp web component (lit-material-timestamp) — absolute or relative date/time display on a native <time> element.

  • 1.2 KB gzipped
  • @lit-material/timestamp 0.0.3
  • Renders on the server

Example

Install

npm install @lit-material/timestamp @lit-material/tokens
import "@lit-material/timestamp";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-timestamp>

A date/time display built on the native <time> element — its machine-readable datetime attribute always holds a full ISO string regardless of how the visible text is formatted.

Properties

PropertyAttributeTypeDefaultDescription
datedatestring""An ISO 8601 date-time string.
dateFormatdate-formatTimestampDateFormat"medium"
timeFormattime-formatTimestampTimeFormat"none"
relativerelativebooleanfalse
localelocalestring""BCP 47 locale tag. Defaults to the browser's own locale when unset.

CSS parts

PartDescription
timeThe <time> element.

Source on GitHub npm