# Time — SvelteKit UI

Package: sveltekit-ui 1.1.94

Page: https://www.sveltekit-ui.com/components/time

Category: Data & content

Displays a formatted time value with options for text color customization, format, granularity, and timezone adjustments.

Public component import: `Time`

Public manager import: `create_time_manager`

## Usage

```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>
```

## Configuration

### `val`

- type: string or null
- default: null
- description: The input value representing a date or time, in ISO 8601 format or any other recognizable format.

### `format`

- type: string or null
- default: null
- description: The input format of the `val` for parsing the date/time.

### `granularity`

- type: string or null
- default: null
- description: Defines the level of detail to display (e.g., 'minute', 'hour').

### `timezone`

- type: string or null
- default: null
- description: Specifies the timezone for displaying the time (e.g., 'UTC', 'America/New_York').

### `display_format`

- type: string or null
- default: null
- description: Defines how the time should be displayed (e.g., 'calendar_date' for YYYY-MM-DD).

### `text_color`

- type: CSS color or null
- default: null
- description: The color of the displayed time text.

## Methods

### `init()`

- description: Initializes the manager by parsing the provided `val` into a formatted datetime and content.

## Returned state

### `datetime`

- type: string or null
- description: The machine-readable datetime attribute in ISO 8601 format.

### `content`

- type: string or null
- description: The human-readable content derived from the provided `val` and `display_format`.

### `text_color`

- type: CSS color or null
- description: The color applied to the displayed time text.
