Timestamp

Table of Contents

Description

The Timestamp component displays a formatted timestamp using custom format tokens. It extends the ShadowComponent class for encapsulated styling.

Basic Usage

Use the Timestamp component to display a formatted timestamp. The component will automatically format the timestamp using the default format or a custom format with tokens.

<k-timestamp timestamp="1633024800000"></k-timestamp>

Custom Format

Use the format attribute to specify a custom format using tokens like YYYY (4-digit year), MM (2-digit month), DD (2-digit day), hh (2-digit hour), mm (2-digit minute), and ss (2-digit second).

<k-timestamp timestamp="1633024800000" format="MM/DD/YYYY"></k-timestamp>

Time Format

Display time with custom formatting using hour, minute, and second tokens.

<k-timestamp timestamp="1633024800000" format="hh:mm:ss"></k-timestamp>

JavaScript Reference

Constructor

Extends ShadowComponent

Requirements

Properties

timestamp: number

The timestamp to be formatted and displayed. Syncs to timestamp attribute.

format: string

The format to be used for formatting the timestamp using tokens like YYYY, MM, DD, hh, mm, ss. If not provided, uses the default format. Syncs to format attribute.

locale: string

The locale to be used for formatting the timestamp. Syncs to locale attribute.

Methods

The Timestamp class does not introduce any new methods beyond those provided by the ShadowComponent class.