NOTE: Introduced feature in
v0.4.10
.
TimeStamp
formats an ISO 8601 / RFC 3339 timestamp into a human readable string, using the user preferences provided by the Browser.
<script>
import {TimeStamp} from "@kahi-ui/framework";
const timestamp = "13:00:42";
</script>
<TimeStamp {timestamp} />
Imports
<script>
import {TimeStamp} from "@kahi-ui/framework";
</script>
12 Hour
You can have the timestamp render as 12-hour time (1...12 AM/PM) instead of 24-hour time (0...23) via the hour_12
property.
<script>
import {TimeStamp} from "@kahi-ui/framework";
const timestamp = "13:00:42";
</script>
<TimeStamp hour_12 {timestamp} />
Custom Format
NOTE: By using custom format settings, the user's defaults will not be loaded and you will have to opt into each unit of information.
You can customize how each individual component of the timestamp is displayed via the hour
, minute
, and second
properties respectively.
<script>
import {TimeStamp} from "@kahi-ui/framework";
const timestamp = "13:00:42";
</script>
<TimeStamp hour="2-digit" hour_12 {timestamp} />