{{code1}}
{{code2}}
Name | Type | Default value | Description |
---|---|---|---|
disabled
|
boolean | null |
If true, the picker is readonly and can't be modified |
showSpinners
|
boolean | true |
If true, the spinners above and below input are visible |
showSeconds
|
boolean | true |
If true, it is not possible to select seconds |
disableMinute
|
boolean | false |
If true, the minute is readonly |
defaultTime
|
Array | undefined |
An array [hour, minute, second] for default time when the date is not yet defined |
stepHour
|
number | 1 |
The number of hours to add/substract when clicking hour spinners |
stepMinute
|
number | 1 |
The number of minutes to add/substract when clicking minute spinners |
stepSecond
|
number | 1 |
The number of seconds to add/substract when clicking second spinners |
color
|
ThemePalette | undefined |
Color palette to use on the datepicker's calendar |
enableMeridian
|
boolean | false |
Whether to display 12H or 24H mode |
hideTime
|
boolean | false |
If true, the time is hidden |
touchUi
|
boolean | false |
Whether the calendar UI is in touch mode. In touch mode the calendar opens in a dialog rather than a popup and elements have more padding to allow for bigger touch targets. |
The datepicker was built to be date implementation agnostic. This means that it can be made to work with a variety of different date implementations. However it also means that developers need to make sure to provide the appropriate pieces for the datepicker to work with their chosen implementation.
The easiest way to ensure this is to import one of the provided date modules:
NgxMatNativeDateModule | NgxMatMomentModule | |
---|---|---|
Date type | Date | Moment |
Dependencies | None | Moment.js |
Import from | @angular-material-components/datetime-picker | @angular-material-components/moment-adapter |
{{code4}}
Please note: NgxMatNativeDateModule is based off the functionality available in JavaScript's native Date object. Thus it is not suitable for many locales. One of the biggest shortcomings of the native Date object is the inability to set the parse format.
We highly recommend using the NgxMatMomentModule or a custom NgxMatDateAdapter that works with the formatting/parsing library of your choice.
For example: Creating a custom date adapter{{code5}}
Creating a custom date adapter module
{{code6}}
You can also customize the date format by providing your custom NGX_MAT_DATE_FORMATS in your module.
{{code7}}
@see @angular/material Using a pre-built theme
Add the Material Design icon font to your index.html
{{code8}}
{{code3}}