Date Time Input
A date and a time typed part by part — day, month, year, hour, minute, AM/PM — in the order and on the clock of its locale, as the Date and Time Inputs. In a form, a Temporal.PlainDateTime; in a Date Time Picker, the field.
Usage
Usage
The airport's local time.
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScDateTimeInput, ScField, ScFieldDescription, ScLabel,} from '@semantic-components/ui';
/** A date and a time in a field: named by its label, described by its description. */@Component({Anatomy
One part, in a field: it writes its own parts from the locale — their order, the text between them, its clock — so there is nothing to put inside it. The label, the description and the errors are the field's.
import { ScDateTimeInput, ScField, ScFieldDescription, ScLabel } from '@semantic-components/ui';<div scField> <label scLabel>Departure</label> <div scDateTimeInput [formField]="form.departure"></div> <p scFieldDescription>The airport's local time.</p></div>The value
A Temporal.PlainDateTime, through [formField] or [(value)]: null until every part is filled, and again when one is emptied. No time zone: a local date and time, as a calendar shows them. The day stays within its month; a year of one or two digits is this century's. A whole value pasted — 2026-11-02T14:30, or in the locale's order — fills every part.
Keyboard
| Key | Does |
|---|---|
| Digits | Fill the part; on to the next once no digit can follow |
| A / P | AM / PM, on a 12-hour clock |
| ↑ / ↓ | One up or down — all but the year wrap; an empty part starts at now |
| Page Up / Page Down | A bigger step: the year by 5, the month by 3, the day by 7, hours by 2, minutes and seconds by 15 |
| Home / End | The part's lowest / highest |
| Backspace | A digit back, then the part emptied, then the part before |
| Delete | Empties the part |
| ← / → | The part to the left / right, as they show |
| / . : ,, Tab | The next part (Tab: then out) |
Accessibility
- A group, named by the field's label; each part a spin button named in the locale's words (day, month, year, hour, minute, AM/PM), with its value, its range and its text — the month by its name; the field's description is read with it.
- Each part is an input: the number pad on a phone, a part to tap.
- Out of its limits, on an unavailable day, or invalid once left: every part is marked invalid; the message is the field's.
- It reads in its locale's direction, the clock's digits left to right; the arrows follow the parts as they show.
Examples
Hour cycle
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScDateTimeInput, ScField, ScLabel } from '@semantic-components/ui';
/** The locale's clock by default; 24 hours with seconds, or 12 with the hour in two digits. */@Component({ selector: 'app-hour-cycle-date-time-input-demo', imports: [ScDateTimeInput, ScField, ScLabel], template: ` <div class="grid w-full max-w-xl grid-cols-1 gap-4 sm:grid-cols-2"> <div scField>Limits
November 2, 9:00 AM to November 30, 6:00 PM; not on Sundays.
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScDateTimeInput, ScField, ScFieldDescription, ScLabel,} from '@semantic-components/ui';
/** minDateTime and maxDateTime, and unavailable days: outside them, marked invalid. */@Component({Locale
import { Component, HostAttributeToken, LOCALE_ID, ViewEncapsulation, inject, input, model, signal,} from '@angular/core';Disabled
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScDateTimeInput, ScField, ScLabel } from '@semantic-components/ui';
/** Disabled: its parts leave the tab order. */@Component({ selector: 'app-disabled-date-time-input-demo', imports: [ScDateTimeInput, ScField, ScLabel], template: ` <div scField class="w-64"> <label scLabel>Starts</label>Read-only
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScDateTimeInput, ScField, ScLabel } from '@semantic-components/ui';
/** Read-only: its parts can be focused and read, not changed. */@Component({ selector: 'app-read-only-date-time-input-demo', imports: [ScDateTimeInput, ScField, ScLabel], template: ` <div scField class="w-64"> <label scLabel>Signed</label>Form
import { Component, ViewEncapsulation, signal } from '@angular/core';import { FormField, FormRoot, form, required, validate,} from '@angular/forms/signals';import { ScButton,Controlled
Reminder at 2026-11-02T07:45
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScButton, ScDateTimeInput, ScField, ScLabel,} from '@semantic-components/ui';
/** Its value in a signal, two-way; clear() empties every part. */@Component({RTL
بالتوقيت المحلي للمطار.
import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation, signal } from '@angular/core';import { ScDateTimeInput, ScField, ScFieldDescription, ScLabel,} from '@semantic-components/ui';
/** In a right-to-left page: the Arabic date reads right to left, the clock's digits left to right; the arrows follow the parts as they show. */API reference
Each part takes class, merged over its own (cn: a later class wins); the look is the style's segmented input, as the Date and Time Inputs'.
| Part | Selector | Description |
|---|---|---|
ScDateTimeInput | div[scDateTimeInput] | The group, its parts written from the locale, in the locale's direction. data-empty, data-invalid, data-disabled, data-readonly. exportAs scDateTimeInput: clear(), focus(options, part), segments(), parts(). |
ScDateTimeSegment | input[scDateTimeSegment] | A part: an input (spin button) the input writes, one per part, from the locale — the Date and Time Inputs' too; not one to place or style yourself: its look is the style's (segmentedInput.segment). data-type, data-empty. |
| Input | Type | Default | Description |
|---|---|---|---|
value | Temporal.PlainDateTime | null | null | Two-way, or [formField]: null until every part is filled. |
hourCycle | 12 | 24 | the locale's | A 12-hour clock (with AM/PM), or 24. |
granularity | 'hour' | 'minute' | 'second' | 'minute' | The smallest part it shows. |
leadingZeros | boolean | false | The hour always in two digits (09); else the locale's way. |
minDateTime, maxDateTime | Temporal.PlainDateTime | — | A value outside them is marked invalid. |
unavailable | (date: Temporal.PlainDate) => boolean | () => false | Days that can’t be picked: marked invalid. |
disabled, readonly, required, invalid, touched | boolean | false | Bound by [formField]: from the schema and its state. |