Live preview

Interactive example

Loading example…

Usage

Import the component and its manager, then make it your own.

ComponentTime
Managercreate_time_manager

svelte

<script>
  // Import the shared stylesheet once in your application's root layout.
  import "sveltekit-ui/style.css"
  import { Time, create_time_manager } from "sveltekit-ui"

  const manager = create_time_manager({
    val: "2026-09-15",
    format: "calendar_date",
    display_format: "calendar_date",
  })
</script>

<p>Due: <Time {manager} /></p>

API reference

Configure the manager, call its methods, and read its reactive state.

6 entries in configuration

PropertyTypeDefaultDescription
valstring or null nullThe input value representing a date or time, in ISO 8601 format or any other recognizable format.
formatstring or null nullThe input format of the `val` for parsing the date/time.
granularitystring or null nullDefines the level of detail to display (e.g., 'minute', 'hour').
timezonestring or null nullSpecifies the timezone for displaying the time (e.g., 'UTC', 'America/New_York').
display_formatstring or null nullDefines how the time should be displayed (e.g., 'calendar_date' for YYYY-MM-DD).
text_colorCSS color or null nullThe color of the displayed time text.