Date & time¶
Date pickers and time pickers allow users to select and navigate through past, present, and future dates and times.
Usage¶
These components are used in scenarios where users need to input specific dates, times, or date ranges.
Date pickers typically include an expandable calendar menu and a text input field, while time pickers focus solely on time selection, usually a text input field or dropdown menu for selecting specific times.

When to use¶
- To collect absolute date and time inputs.
- For scheduling tasks.
- In forms.
- To select date ranges for generating reports or viewing historical data.
- For relative date selection, use date range filter.
Best practices¶
- Ensure the format of dates and times adheres to the user's locale settings. See localization for more details.
- Ensure placeholders are also localized to match the user's regional settings (e.g., "MM/DD/YYYY").
- When required, validation can be set for all time inputs.
- Provide clear and concise labels for input fields.
Design¶
Basic anatomy¶
Date pickers and date-time pickers consist of an optional input field and a calendar view. The input field allows users to manually type dates and times. When needed, the calendar view opens for visual selection, making this structure common across all variants.

- Label (optional), 2. Input, 3. Calendar button, 4. Month & Year control, 5. Previous and Next month control, 6. Default day, 7. Selected day, 8. Current day, 9. Off month day, 10. Today control
Single date and date-time picker¶
The single date picker allows users to select a specific date, either by typing in the input field or using the calendar view. When the time option is enabled, users can also select a specific time.

Date and date-time range picker¶
The date range picker enables users to choose a start and end date. When the time option is enabled, a two-month view layout is used.

Time picker¶
The time picker is a component with separate input fields for individually setting units of time measurement (e.g., hh, mm, …). Minutes, seconds, and milliseconds are optional and can be configured to show or hide as needed.

Code¶
The datepicker and timepicker components are highly configurable. The datepicker optionally includes the timepicker.
The SiDatepickerComponent, SiTimepickerComponent, as well as the SiDatepickerDirective, to attach the datepicker component to a HTML input element, are provided by the SiDatepickerModule Angular module.
Usage¶
Datepicker can be imported using the module
import { SiDatepickerModule } from '@siemens/element-ng/datepicker';
@NgModule({
imports: [SiDatepickerModule, ...]
})
or as a standalone component:
import {
SiDateInputDirective,
SiDatepickerComponent,
SiDatepickerDirective,
SiDateRangeComponent
} from '@siemens/element-ng/datepicker';
@Component({
imports: [
SiDateInputDirective,
SiDatepickerComponent,
SiDatepickerDirective,
SiDateRangeComponent,
...
]
})
Datepicker without time¶
The datepicker component can be added to any view. Bidirectional binding of the date object is provided by the date property. The configuration is handled by the config object as documented in the API.
Datepicker with time control¶
- Setting
showTimein the config will display the timepicker within the date picker. - A switch enables the user to include (
Consider time) the time or not (Ignore time). - Initial switch enablement is controlled by the
disabledTimeflag and changes are emitted by thedisabledTimeChangeoutput property. - Use the
mandatoryTimeflag to hide the switch.
Datepicker with date range¶
The si-datepicker allows to pick date ranges. Use the two-way binded property dateRange and set enableDateRange: true in configuration.
Input element with datepicker¶
The SiDatepickerDirective attaches the datepicker to an HTML input element. Without any additional configuration, the Angular locale date formatter is used to write the selected date into the input field. Changes of the input field are also parsed and used to set the date in the datepicker. Optionally, you can provide a custom date and time format using the config object.
The directive implements the Angular ControlValueAccessor and can be used in Angular Forms.
Input element with date range picker¶
The SiDateRangeComponent component is a custom component which can be used to use datepicker as range selector.
The component implements the Angular ControlValueAccessor and can be used in Angular Forms.
Timepicker¶
The timepicker component is a custom component with individual input fields for setting the parts of the time individually, like hours, and minutes. It implements the ControlValueAccessor and can be used in Angular Forms.
import { SiDatepickerComponent } from '@siemens/element-ng/datepicker'; Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| calendarWeekLabel ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.CALENDAR_WEEK_LABEL:Calendar week` | Aria label for week number column |
| config ¶ | DatepickerConfig | {} | Object to configure the datepicker. |
| date ¶ | Date | undefined | The selected date of the datepicker. Use for initialization and for bidirectional binding. | |
| dateRange ¶ | DateRange | undefined | The selected date range of the datepicker. Use for initialization and for bidirectional binding. | |
| disabledTime ¶ | boolean | false | Disabled the optional visible time picker. |
| focusedDate ¶ | Date | undefined | The date which is currently focused Compare to the selected date or range the calendar requires to have one element to focus. | |
| hideTimeToggle ¶ | boolean | false | Option to hide the time switch. |
| initialFocus ¶ | boolean | false | Set initial focus to calendar body. |
| nextLabel ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.NEXT:Next` | Aria label for the next button. Needed for a11y. |
| previousLabel ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.PREVIOUS:Previous` | Aria label for the previous button. Needed for a11y. |
| rangeType ¶ | RangeType | 'START' | Use this to force date range operation to select either start date or end date. |
| time12h ¶ | boolean | undefined | Enable/disable 12H mode in timepicker. Defaults to locale |
| timepickerLabel ¶ | string | undefined | Optional timepicker label. |
Output Properties¶
| Name | Type | Description |
|---|---|---|
| configChange ¶ | DatepickerConfig | Object to configure the datepicker. |
| dateChange ¶ | Date | undefined | The selected date of the datepicker. Use for initialization and for bidirectional binding. |
| dateRangeChange ¶ | DateRange | undefined | The selected date range of the datepicker. Use for initialization and for bidirectional binding. |
| disabledTimeChange ¶ | boolean | Disabled the optional visible time picker. |
| focusedDateChange ¶ | Date | undefined | The date which is currently focused Compare to the selected date or range the calendar requires to have one element to focus. |
| rangeTypeChange ¶ | RangeType | Use this to force date range operation to select either start date or end date. |
Attributes and Methods¶
| Name | Type | Description |
|---|---|---|
| focusActiveCell() ¶ | () => void | Focus the active cell in view. The function is required to transfer the focus from input to the active date cell. |
import { SiDateRangeComponent } from '@siemens/element-ng/datepicker'; Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| ariaLabelCalendarButton ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.CALENDAR_TOGGLE_BUTTON:Open calendar` | Aria label of the date-range calendar toggle button. |
| autoClose ¶ | boolean | false | Automatically close overlay on date selection. |
| disabled ¶ | boolean | false | Whether the date range input is disabled. |
| endDatePlaceholder ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.END_DATE_PLACEHOLDER:End date` | Placeholder of the end date input. |
| endTimeLabel ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.END_TIME_LABEL:To` | Form label of the start timepicker. |
| errormessageId ¶ | string | `${this.id()}-errormessage` | This ID will be bound to the Implements SiFormItemControl |
| id ¶ | string | `__si-date-range-${SiDateRangeComponent.idCounter++}` | The actual id of the control that should be used in the Implements SiFormItemControl |
| readonly ¶ | boolean | false | Whether the date range input is readonly. |
| scrollStrategy ¶ | ScrollStrategy | defaultConnectedOverlayScrollStrategy() | Optional CDK scroll strategy used for the datepicker overlay. |
| siDatepickerConfig ¶ | DatepickerInputConfig | { enableDateRange: true } | Date range component configuration. |
| startDatePlaceholder ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.START_DATE_PLACEHOLDER:Start date` | Placeholder of the start date input. |
| startTimeLabel ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.START_TIME_LABEL:From` | Form label of the start timepicker. |
| value ¶ | DateRange | undefined | Set the date-range object displayed in the control. The input can be used if the control is used outside Angular forms. |
Output Properties¶
| Name | Type | Description |
|---|---|---|
| disabledTimeChange ¶ | boolean | Emits an event to notify about disabling the time from the range picker. When time is disable, we construct a pure date objects in UTC 00:00:00 time. |
| siDatepickerClose ¶ | CloseCause | Output event on closing datepicker e.g. by clicking backdrop or escape key. |
| siDatepickerConfigChange ¶ | DatepickerInputConfig | Date range component configuration. |
| siDatepickerRangeChange ¶ | DateRange | undefined | Emits on the date range value changes. |
| valueChange ¶ | DateRange | undefined | Set the date-range object displayed in the control. The input can be used if the control is used outside Angular forms. |
Attributes and Methods¶
| Name | Type | Default | Description |
|---|---|---|---|
| (readonly) labelledby ¶ | string | ... | ID that should be assigned to the label element inside the SiFormItemComponent. If the target control is not of type input, select or button, it cannot be referenced by a label. Instead, aria-labelledby must be used to create a reference to a label. In such a case, an implementation of SiFormItemControl must provide the id of the label in labelledby. SiFormItemComponent will apply the id to the label so that it can be used inside the control to reference it in the aria-labelledby attribute. Implements SiFormItemControl |
import { SiTimepickerComponent } from '@siemens/element-ng/datepicker'; Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| disabled ¶ | boolean | false | All input fields will be disabled if set to true. |
| errormessageId ¶ | string | `${this.id()}-errormessage` | This ID will be bound to the Implements SiFormItemControl |
| hideLabels ¶ | boolean | false | Hide the labels of the input fields. |
| hoursAriaLabel ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.HOURS:Hours` | |
| hoursLabel ¶ | TranslatableString | 'hh' | Visible label for the hours input. |
| hoursPlaceholder ¶ | string | 'hh' | Placeholder for the hours input. |
| id ¶ | string | `__si-timepicker-${SiTimepickerComponent.idCounter++}` | The actual id of the control that should be used in the Implements SiFormItemControl |
| max ¶ | Date | undefined | A maximum time limit. The date part of the date object will be ignored. | |
| meridians ¶ | string[] | undefined | Custom labels for the AM and PM options. | |
| meridiansAriaLabel ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.PERIOD:Period` | |
| meridiansLabel ¶ | TranslatableString | 'am/pm' | Visible label for the AM/PM selector. |
| millisecondsAriaLabel ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.MILLISECONDS:Milliseconds` | |
| millisecondsLabel ¶ | TranslatableString | 'ms' | Visible label for the milliseconds input. |
| millisecondsPlaceholder ¶ | string | 'ms' | Placeholder for the milliseconds input. |
| min ¶ | Date | undefined | A minimum time limit. The date part of the date object will be ignored. | |
| minutesAriaLabel ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.MINUTES:Minutes` | |
| minutesLabel ¶ | TranslatableString | 'mm' | Visible label for the minutes input. |
| minutesPlaceholder ¶ | string | 'mm' | Placeholder for the minutes input. |
| readonly ¶ | boolean | false | Whether the time inputs are read-only. |
| secondsAriaLabel ¶ | TranslatableString | $localize`:@@SI_DATEPICKER.SECONDS:Seconds` | |
| secondsLabel ¶ | TranslatableString | 'ss' | Visible label for the seconds input. |
| secondsPlaceholder ¶ | string | 'ss' | Placeholder for the seconds input. |
| showMeridian ¶ | boolean | undefined | Show time in 12-hour period including the select to toggle between AM/PM. | |
| showMilliseconds ¶ | boolean | false | Whether the milliseconds input is displayed. |
| showMinutes ¶ | boolean | true | Whether the minutes input is displayed. |
| showSeconds ¶ | boolean | false | Whether the seconds input is displayed. |
Output Properties¶
| Name | Type | Description |
|---|---|---|
| inputCompleted ¶ | void | Emits when the user presses Enter in the final time input. |
| isValid ¶ | boolean | Emits whether the entered time components form a valid time. |
| meridianChange ¶ | string | Emits the selected meridian when it changes. |
Attributes and Methods¶
| Name | Type | Default | Description |
|---|---|---|---|
| (readonly) labelledby ¶ | string | ... | ID that should be assigned to the label element inside the SiFormItemComponent. If the target control is not of type input, select or button, it cannot be referenced by a label. Instead, aria-labelledby must be used to create a reference to a label. In such a case, an implementation of SiFormItemControl must provide the id of the label in labelledby. SiFormItemComponent will apply the id to the label so that it can be used inside the control to reference it in the aria-labelledby attribute. Implements SiFormItemControl |
import { SiDatepickerDirective } from '@siemens/element-ng/datepicker'; Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| autoClose ¶ | boolean | false | Automatically close overlay on date selection. Do not use this behavior with config showTime = true, because it will close the overlay when the user change one of the time units. |
| disabledinherited ¶ | boolean | false | Whether the date range input is disabled. Inherited from SiDateInputDirective |
| errormessageIdinherited ¶ | string | `${this.id()}-errormessage` | This ID will be bound to the Inherited from SiDateInputDirective Implements SiFormItemControl |
| idinherited ¶ | string | `si-date-input-${SiDateInputDirective.idCounter++}` | The actual id of the control that should be used in the Inherited from SiDateInputDirective Implements SiFormItemControl |
| readonlyinherited ¶ | boolean | false | Whether the date range input is readonly. Inherited from SiDateInputDirective |
| siDatepickerConfiginherited ¶ | DatepickerInputConfig | undefined | {} | Configuration object for the datepicker. Inherited from SiDateInputDirective |
| siDatepickerScrollStrategy ¶ | ScrollStrategy | defaultConnectedOverlayScrollStrategy() | Optional CDK scroll strategy used for the datepicker overlay. |
Output Properties¶
| Name | Type | Description |
|---|---|---|
| dateChangeinheritedprotected ¶ | Date | undefined | Emits a new Inherited from SiDateInputDirective |
| siDatepickerClose ¶ | CloseCause | Output event on closing datepicker e.g. by clicking backdrop or escape key. |
| siDatepickerConfigChangeinherited ¶ | DatepickerInputConfig | undefined | Configuration object for the datepicker. Inherited from SiDateInputDirective |
| siDatepickerDisabledTimeinherited ¶ | boolean | Emits an event to notify about disabling the time from the datepicker. When time is disable, we construct a pure date object in UTC 00:00:00 time. Inherited from SiDateInputDirective |
| stateChangeinherited ¶ | void | Emits an event on state changes e.g. readonly, disable, ... . Inherited from SiDateInputDirective |
Attributes and Methods¶
| Name | Type | Description |
|---|---|---|
| registerOnChange()inherited ¶ | Inherited from SiDateInputDirective Implements | |
| registerOnTouched()inherited ¶ | Inherited from SiDateInputDirective Implements | |
| registerOnValidatorChange()inherited ¶ | Inherited from SiDateInputDirective Implements | |
| setDisabledState()inherited ¶ | Inherited from SiDateInputDirective Implements Parameters
| |
| validate()inherited ¶ | (c: AbstractControl<any, any, any>) => ValidationErrors | null | Inherited from SiDateInputDirective Implements |
| writeValue()inherited ¶ | Inherited from SiDateInputDirective Implements |
Types Documentation¶
-
Defines the time is disabled when visible. Will also be updated on user change. Default is
false. -
Text or translation key for the
disableddisable time. Default isIgnore time. -
Options to turn on date range selection.
-
Text or translation key for the
enableddisable time. Default isConsider time. -
Consider time with minDate and maxDate
-
Option to use two months view for date range picking.
-
Configuration for hiding week numbers. Default is
false. -
Hides disable time switch in the timepicker part and includes mandatory the time in the picker.
-
Maximal (latest) selectable date.
-
Minimal (earliest) selectable date.
-
Only month and year are selectable.
-
Defines the timepicker milliseconds visibility . Default is
false. -
Defines the timepicker minutes visibility. Default is
true. -
Defines the timepicker seconds visibility . Default is
false. -
Defines the timepicker visibility. Default is
false. -
Text or translation key for today button title. Default is
Today. -
Defines the starting day of the week. Default is
monday.
-
Similar to
dateTimeFormat, but used when only a date is displayed (e.g. whenshowTime === falseordisabledTime === true). Only numeric date formats are supported. -
A custom date/time format according the Angular date pipe (see https://angular.dev/api/common/DatePipe). Only numeric date formats are supported. The format is used to render the time of a date-time criterion. If not specified,
mediumTimeis used if theshowSecondsflag is true, otherwiseshortTimeas default. For the date-only case, 'shortDate' is used. -
Defines the time is disabled when visible. Will also be updated on user change. Default is
false.disabledTime?:
booleanInherited from DatepickerConfig¶ -
Text or translation key for the
disableddisable time. Default isIgnore time.disabledTimeText?:
TranslatableStringInherited from DatepickerConfig¶ -
Options to turn on date range selection.
enableDateRange?:
booleanInherited from DatepickerConfig¶ -
Text or translation key for the
enableddisable time. Default isConsider time.enabledTimeText?:
TranslatableStringInherited from DatepickerConfig¶ -
Consider time with minDate and maxDate
enableTimeValidation?:
booleanInherited from DatepickerConfig¶ -
Option to use two months view for date range picking.
enableTwoMonthDateRange?:
booleanInherited from DatepickerConfig¶ -
endTimeLabel?:
stringInherited from DatepickerConfig¶ -
hideLabels?:
booleanInherited from DatepickerConfig¶ -
Configuration for hiding week numbers. Default is
false.hideWeekNumbers?:
booleanInherited from DatepickerConfig¶ -
hoursAriaLabel?:
stringInherited from DatepickerConfig¶ -
hoursLabel?:
stringInherited from DatepickerConfig¶ -
hoursPlaceholder?:
stringInherited from DatepickerConfig¶ -
Hides disable time switch in the timepicker part and includes mandatory the time in the picker.
mandatoryTime?:
booleanInherited from DatepickerConfig¶ -
Maximal (latest) selectable date.
maxDate?:
DateInherited from DatepickerConfig¶ -
meridians?:
string[]Inherited from DatepickerConfig¶ -
meridiansAriaLabel?:
stringInherited from DatepickerConfig¶ -
meridiansLabel?:
stringInherited from DatepickerConfig¶ -
millisecondsAriaLabel?:
stringInherited from DatepickerConfig¶ -
millisecondsLabel?:
stringInherited from DatepickerConfig¶ -
millisecondsPlaceholder?:
stringInherited from DatepickerConfig¶ -
Minimal (earliest) selectable date.
minDate?:
DateInherited from DatepickerConfig¶ -
minutesAriaLabel?:
stringInherited from DatepickerConfig¶ -
minutesLabel?:
stringInherited from DatepickerConfig¶ -
minutesPlaceholder?:
stringInherited from DatepickerConfig¶ -
Only month and year are selectable.
onlyMonthSelection?:
booleanInherited from DatepickerConfig¶ -
secondsAriaLabel?:
stringInherited from DatepickerConfig¶ -
secondsLabel?:
stringInherited from DatepickerConfig¶ -
secondsPlaceholder?:
stringInherited from DatepickerConfig¶ -
Defines the timepicker milliseconds visibility . Default is
false.showMilliseconds?:
booleanInherited from DatepickerConfig¶ -
Defines the timepicker minutes visibility. Default is
true.showMinutes?:
booleanInherited from DatepickerConfig¶ -
Defines the timepicker seconds visibility . Default is
false.showSeconds?:
booleanInherited from DatepickerConfig¶ -
Defines the timepicker visibility. Default is
false.showTime?:
booleanInherited from DatepickerConfig¶ -
startTimeLabel?:
stringInherited from DatepickerConfig¶ -
Text or translation key for today button title. Default is
Today.todayText?:
TranslatableStringInherited from DatepickerConfig¶ -
Defines the starting day of the week. Default is
monday.weekStartDay?:
WeekStartInherited from DatepickerConfig¶
Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit. Equivalent to a normal string in usage and functionality.
-
Backdrop:
CloseCause.Backdrop='backdrop'¶ -
Detach:
CloseCause.Detach='detach'¶ -
Escape:
CloseCause.Escape='escape'¶ -
Select:
CloseCause.Select='select'¶
Common interface for form item controls. Controls that should be connected to SiFormItemComponent must implement this interface and must be provided using the SI_FORM_ITEM_CONTROL token.
-
Generated ID that the SiFormItemComponent will assign to the element containing the error messages. Implementations of SiFormItemControl must generate this ID and assign it to the
aria-describedbyattribute of their focusable elements.errormessageId:
readonlystring | Signal<string>¶ -
The actual id of the control that should be used in the
forattribute of a label.id?:
readonlystring | Signal<string | undefined>¶ - readonly
If the control is meant to be used a checkbox. This affects the label positioning.
-
ID that should be assigned to the label element inside the SiFormItemComponent.
If the target control is not of type input, select or button, it cannot be referenced by a label. Instead, aria-labelledby must be used to create a reference to a label. In such a case, an implementation of SiFormItemControl must provide the id of the label in labelledby. SiFormItemComponent will apply the id to the label so that it can be used inside the control to reference it in the aria-labelledby attribute.
labelledby?:
readonlystring | Signal<string | undefined> | null¶
Except where otherwise noted, content on this site is licensed under MIT License.