Date Picker
A date picker component.
Installation
The Date Picker component is built with the Popover and the Calendar components.
npx nx g @spartan-ng/cli:ui datepicker
ng g @spartan-ng/cli:ui datepicker
Usage
Examples
Custom Configs
Use provideHlmDatePickerConfig
to provide custom configs for the date picker component throughout the application.
autoCloseOnSelect: boolean;
iftrue
, the date picker will close when a date is selected.formatDate: (date: T) => string;
defines the default format how the date should be displayed in the UI.transformDate: (date: T) => T;
defines the default format how the date should be transformed before saving to model/form.
Multiple Selection
Use hlm-date-picker-multi
for multiple date selection. Limit the selectable dates using minSelection
and maxSelection
inputs.
Format Date
Use formatDate
input to override the global date format for the date picker component.
Form
Sync the date to a form by adding formControlName
to hlm-date-picker
.
Form Multiple Selection
Sync the dates to a form by adding formControlName
to hlm-date-picker-multi
.