Home

Awesome

Date Picker

This is a configurable date-picker build for Angular applications.
Supports latest (Angular 15) version. For older versions please checkout the CHANGELOG.md file.

DEMO

npm version Build Status Package Quality

Screenshots

Day:

Imgur

DayTime:

Imgur

Month:

Imgur

Time:

Imgur

Installation:

  1. Download from npm:
    npm install ng2-date-picker --save
  2. Import the DpDatePickerModule module:
    import {DpDatePickerModule} from 'ng2-date-picker';
  3. Add DpDatePickerModule to your module imports:
 @NgModule({ ... imports: [ ... DpDatePickerModule ] })
  1. Add @import '~@angular/cdk/overlay-prebuilt.css'; to your global styles (usually styles.(scss/sass/css/less). You could also add it via the angular.json file under the styles attribute:
 "projects": {
    "your-project": {
      ...
      "architect": {
        "build": {
          ...
          "options": {
            ...
            "styles": [
              ...
              "node_modules/@angular/cdk/overlay-prebuilt.css"
            ],
   ...    

Contributors

This project exists thanks to all the people who contribute. [Contribute].
<a href="graphs/contributors"><img src="https://opencollective.com/angular-datepicker/contributors.svg?width=890" /></a>

Backers

Thank you to all our backers! 🙏 [Become a backer]
<a href="https://opencollective.com/angular-datepicker#backers" target="_blank"><img src="https://opencollective.com/angular-datepicker/backers.svg?width=890"></a>

Usage

Put the dp-date-picker component wherever you need it.

Locale

In order to change the locale you will need first to import the locale you want to work with and apply it to the Dayjs object. More information about this can be found in the dayjs documentation here.
Note: The locale is set to en by default. If you change the locale after the first initialization of the date-picker then you will need to reinitialize the date-picker.

Attributes (Input):

NameTypeDefaultApplies ToDescription
mode"day"|"month"|"time"|"daytime""day"AllThe mode of the calender which will be displayed in the picker
displayDateDayjs|Stringcurrent dateday|month|daytimeIndicates on what date to open the calendar on
disabledBooleanfalseAllIf set to true the input would be disabled
placeholderString""AllThe date-picker input placeholder
requiredBooleanundefinedAllThis is a validation rule, if there won't be any selected date then the containing form will be invalid.
minDateDayjs|Stringundefinedday|month|daytimeThis is a validation rule, if the selected date will be before minDate the containing form will be invalid. Note: if provided as string format configuration should be provided in the config object.
maxDateDayjs|Stringundefinedday|month|daytimeThis is a validation rule, if the selected date will be after maxDate the containing form will be invalid. Note: if provided as string format configuration should be provided in the config object.
minTimeDayjs|StringundefinedtimeThis is a validation rule, if the selected date will be before minTime the containing form will be invalid. Note: if provided as string format configuration should be provided in the config object.
maxTimeDayjs|StringundefinedtimeThis is a validation rule, if the selected date will be after maxTime the containing form will be invalid. Note: if provided as string format configuration should be provided in the config object.
themeString""AllTheme is a class added to the popup container (and inner components) - this will allow styling of the calendar when it's appended to outer element (for example - body). There is a built in theme named dp-material, you can find it in the demo.
configIDatePickerConfigSee BelowAllConfiguration object - see description below.

Attributes (Output):

NameEvent ArgumentsApplies ToDescription
onChangeCalendarValueAll PickersThis event will be emitted on every valid value change, if you want to receive every value (valid and invalid) please use the native ngModelChange output.
openundefinedAll PickersThis event will be emitted when picker is opened.
closeCalendarValueAll PickersThis event will be emitted when picker is closed.
onGoToCurrentvoidAll PickersThis event will be emitted when click was made on go to current button.
onLeftNavvoidAll PickersThis event will be emitted when click was made on left navigation button.
onRightNavvoidAll PickersThis event will be emitted when click was made on right navigation button.
onSelectISelectionEventAll PickersThis event will be emitted when a date was selected via click or input change (with appropriate indication)

Configuration: In order to provide configurations to the date-picker you need to pass it to the dp-date-picker component:

<dp-date-picker [(ngModel)]="selectedDate" [config]="datePickerConfig"></dp-date-picker>  

Here are the available configurations:

NameTypeDefaultApplies ToDescription
disableKeypressBooleanfalseAllDisables the possibility to change the date value by typing it - changing the date would be possible only from the picker
formatString"DD-MM-YYYY"AllIf ngModel provided as String the format is required, this format also will be used as the input format style.
onOpenDelayNumber0AllThe delay (in ms) between the date picker focusing and the date-picker popup apparel
drops'up'| 'down'undefined down if possibleAllWhether the picker appears below or above the input element.
opens'right'| 'left'undefined right if possibleAllWhether the picker appears aligned to the left or to the right the input element.
closeOnSelectBooleantrue`day\month`
openOnClickBooleantrue`day\month|daytime`
openOnFocusBooleantrue`day\month|daytime`
closeOnSelectDelayNumber100`day\month`
allowMultiSelectBooleanundefined`day\month`
dayBtnFormatStringDD`day\daytime`
dayBtnFormatter(Dayjs) => Stringundefined`day\daytime`
dayBtnCssClassCallback(Dayjs) => Stringundefined`day\daytime`
enableMonthSelectorBooleantrue`day\daytime`
firstDayOfWeekString"su"`day\daytime`
isDayDisabledCallback(Dayjs) => booleanundefined`day\daytime`
monthFormatString"MMM-YYYY"`day\daytime`
monthFormatter(Dayjs) => Stringundefined`day\daytime`
showNearMonthDaysBooleantrue`day\daytime`
showWeekNumbersBooleanfalse`day\daytime`
isMonthDisabledCallback(Dayjs) => booleanundefined`day\month|daytime`
maxDayjs| Stringundefinedday|month|daytimeDisables all dates (on the date-picker) that are set to after the max, note that if invalid date would be set by the input then the date picker value would be the max date but the input will show the user typed date.
minDayjs| Stringundefinedday|month|daytimeDisables all dates (on the date-picker) that are set to before the min, note that if invalid date would be set by the input then the date picker value would be the min date but the input will show the user typed date.
monthBtnFormatStringDD`day\month|daytime`
monthBtnFormatter(Dayjs) => Stringundefined`day\month|daytime`
monthBtnCssClassCallback(Dayjs) => Stringundefined`day\month|daytime`
yearFormatString"YYYY"`day\month|daytime`
yearFormatter(Dayjs) => Stringundefined`day\month|daytime`
hours12FormatString"hh"`daytime\time`
hours24FormatString"HH"`daytime\time`
maxTimeDayjs| Stringundefineddaytime|timeDisables arrow buttons on the time select that would make the time after the maxTime.
meridiemFormatString"A"`daytime\time`
minTimeDayjs| Stringundefineddaytime|timeDisables arrow buttons on the time select that would make the time before the minTime.
minutesFormatString"mm"`daytime\time`
minutesIntervalnumber1`daytime\time`
secondsFormatString"ss"`daytime\time`
secondsIntervalnumber1`daytime\time`
showSecondsbooleanfalse`daytime\time`
showTwentyFourHoursbooleanfalse`daytime\time`
timeSeparatorString":"`daytime\time`
showMultipleYearsNavigationbooleanfalse`day\month|daytime`
multipleYearsNavigateBynumber10`day\month|daytime`
returnedValueTypeECalendarValueDayjsAllThe returned value type (Dayjs, Dayjs[], string, string[]
unSelectOnClickbooleantrue`day\month`
inputElementContainerstring| HTMLElement| ElementRefundefinedAllWill place picker popup relative to the provided elemenr (if string provided will used as a selector)
showGoToCurrentbooleantrueAllShow/Hides the go to current button on the calendars navigation
hideOnOutsideClickbooleantrueAllShow/Hides the picker popup after click outside of the component
closeOnEnterbooleantrueAllHides the picker popup after enter button keypress

API:

In order to use the date-picker api user the @ViewChild annotation in the date-picker containing component class, take at the example below:
Container component:

import {DatePickerComponent} from 'ng2-date-picker';  
  
@Component({  
selector: 'my-container',  
template: `  
<div>  
 <h1>Container</h1> <dp-date-picker #dayPicker></dp-date-picker> <button (click)="open()"></button> <button (click)="close()"></button></div>  
`  
});  
class MyContainer {  
 @ViewChild('dayPicker') datePicker: DatePickerComponent;  
 open() { this.datePicker.api.open(); }  
 close() { this.datePicker.api.close(); }} ```  
  
If you want to use API with [`Directive`](#directive) - you can do it by using `#dateDirectivePicker`, like below:  
```ts  
import {Component, ViewChild} from '@angular/core';  
import {DatePickerDirective} from 'ng2-date-picker';  
  
@Component({  
selector: 'my-container',  
template: `  
<div>  
 <input #dateDirectivePicker="dpDayPicker"> <button (click)="close()"></button></div>  
`  
});  
class MyContainer {  
 @ViewChild('dateDirectivePicker') datePickerDirective: DatePickerDirective;     close() {  
 this.datePickerDirective.api.close(); }} ```  
  
Here is the list of APIs:    
  
| Name                 | Signature                          | Description                      |  
|----------------------|:----------------------------------:|----------------------------------|  
| open                 | `() => void`                       | Opens the date picker            |  
| close                | `() => void`                       | Closes the date picker           |  
| moveCalendarTo       | `(to: Dayjs \| String) => void`   | Moves calendar to specific date  |  
  
## Inline - Day Calendar  
  
You can use the `<dp-day-calendar>` component to display the calendar widget without an associated input box.  
  
i.e.  
```html  
<dp-day-calendar [(ngModel)]="selectedDate" [config]="config"></dp-day-calendar>  

Attributes:

NameTypeDefaultDescription
requiredBooleanundefinedThis is a validation rule, if there won't be any selected date then the containing form will be invalid.
minDateDayjs|StringundefinedThis is a validation rule, if the selected date will be before minDate the containing form will be invalid. Note: if provided as string format configuration should be provided in the config object.
maxDateDayjs|StringundefinedThis is a validation rule, if the selected date will be after maxDate the containing form will be invalid. Note: if provided as string format configuration should be provided in the config object.
themeString''Theme is a class added to the popup container (and inner components) - this will allow styling of the calendar when it's appended to outer element (for example - body). There is a built in theme named dp-material, you can find it in the demo.
configIDayCalendarConfigSee BelowConfiguration object - see description below.

Attributes (Output):

NameEvent ArgumentsDescription
onSelectIDayThis event will be emitted when a day is selected.
onMonthSelectIMonthThis event will be emitted when a month is selected.
onNavHeaderBtnClickECalendarModeThis event will be emitted when the mode of the calendar switches form day to month and vise versa.
onGoToCurrentvoidThis event will be emitted when click was made on go to current button.
onLeftNavvoidThis event will be emitted when click was made on left navigation button.
onRightNavvoidThis event will be emitted when click was made on right navigation button.

Configuration: In order to provide configurations to the day-calendar you need to pass it to the dp-day-calendar component:

<dp-day-calendar [(ngModel)]="selectedDate" [config]="config"></dp-day-calendar>  

Here are the available configurations:

NameTypeDefaultDescription
formatString"DD-MM-YYYY"If ngModel provided as String the format is required, this format also will be used as the input format style.
firstDayOfWeekString"su"The first day of the calendar's week. Should be one of: "su", "mo", "tu", "we", "th", "fr", "sa"
monthFormatString"MMM-YYYY"The date format of the day calendar, the one that seen above the calendar days. Will be overwritten if monthFormatter provided.
monthFormatter(Dayjs) => StringundefinedThe date formatter (callback function) of the day calendar, the one that seen above the calendar days.
yearFormatString"YYYY"The date format of the month calendar, the one that seen above the calendar months. Will be overwritten if yearFormatter provided. (available when enableMonthSelector is set to true).
yearFormatter(Dayjs) => StringundefinedThe date formatter (callback function) of the month calendar, the one that seen above the calendar months. (available when enableMonthSelector is set to true).
allowMultiSelectBooleanundefinedIf set to true will allow for choosing multiple dates. false will force a single selection. If undefined, the picker will attempt to guess based on the type of the input value.
minDayjs|StringundefinedDisables all dates (on the date-picker) that are set to before the min, note that if invalid date would be set by the input then the date picker value would be the min date but the input will show the user typed date.
maxDayjs|StringundefinedDisables all dates (on the date-picker) that are set to after the max, note that if invalid date would be set by the input then the date picker value would be the max date but the input will show the user typed date.
showNearMonthDaysBooleantrueWhether to show/hide next and previous month days.
showWeekNumbersBooleanfalseWhether to show/hide the week number of each week (iso week number).
enableMonthSelectorBooleantrueWhether to enable/disable the selection of a moth granularity picker.
isDayDisabledCallback(Dayjs) => booleanundefinedCallback which should indicate if specific day is disabled.
isMonthDisabledCallback(Dayjs) => booleanundefinedCallback which should indicate if specific month is disabled (month selector).
dayBtnFormatStringDDThe day format of the day button in the calendar.
dayBtnFormatter(Dayjs) => StringundefinedThe formatter (callback function) of the day button in the calendar.
dayBtnCssClassCallback(Dayjs) => StringundefinedCallback which can add custom CSS classes to the day button in the calendar. Multiple classes can be returned with a space between them.
monthBtnFormatStringDDThe month format of the month button in the calendar.
monthBtnFormatter(Dayjs) => StringundefinedThe formatter (callback function) of the month button in the calendar.
monthBtnCssClassCallback(Dayjs) => StringundefinedCallback which can add custom CSS classes to the month button in the calendar. Multiple classes can be returned with a space between them.
showMultipleYearsNavigationbooleanfalseIf set to true will show buttons to navigate by multiple years (10 by default)
multipleYearsNavigateBynumber10Number of years to navigate when showMultipleYearsNavigation is true
numOfMonthRows1, 2, 3, 4, 6, 124Number of rows to be shown on month calendar

Inline - Month Calendar

You can use the <dp-month-calendar> component to display the calendar widget without an associated input box.
i.e.

<dp-month-calendar [(ngModel)]="selectedDate" [config]="config"></dp-month-calendar>  

Attributes:

NameTypeDefaultDescription
requiredBooleanundefinedThis is a validation rule, if there won't be any selected date then the containing form will be invalid.
minDateDayjs|StringundefinedThis is a validation rule, if the selected date will be before minDate the containing form will be invalid. Note: if provided as string format configuration should be provided in the config object.
maxDateDayjs|StringundefinedThis is a validation rule, if the selected date will be after maxDate the containing form will be invalid. Note: if provided as string format configuration should be provided in the config object.
themeString''Theme is a class added to the popup container (and inner components) - this will allow styling of the calendar when it's appended to outer element (for example - body). There is a built in theme named dp-material, you can find it in the demo.
configIMonthPickerConfigSee BelowConfiguration object - see description below.

Attributes (Output):

NameEvent ArgumentsDescription
onSelectIMonthThis event will be emitted when a month is selected.
onNavHeaderBtnClicknullThis event will be emitted when the mode button, in the navigation section, was clicked.
onGoToCurrentvoidThis event will be emitted when click was made on go to current button.
onLeftNavvoidThis event will be emitted when click was made on left navigation button.
onRightNavvoidThis event will be emitted when click was made on right navigation button.

Configuration: In order to provide configurations to the month-calendar you need to pass it to the dp-month-calendar component:

<dp-month-calendar [(ngModel)]="selectedDate" [config]="config"></dp-month-calendar>  

Here are the available configurations:

NameTypeDefaultDescription
formatString"DD-MM-YYYY"If ngModel provided as String the format is required, this format also will be used as the input format style.
yearFormatString"YYYY"The date format of the month calendar, the one that seen above the calendar months. Will be overwritten if yearFormatter provided. (available when enableMonthSelector is set to true).
yearFormatter(Dayjs) => StringundefinedThe date formatter (callback function) of the month calendar, the one that seen above the calendar months. (available when enableMonthSelector is set to true).
allowMultiSelectBooleanundefinedIf set to true will allow for choosing multiple dates. false will force a single selection. If undefined, the picker will attempt to guess based on the type of the input value.
minDayjs|StringundefinedDisables all dates (on the date-picker) that are set to before the min, note that if invalid date would be set by the input then the date picker value would be the min date but the input will show the user typed date.
maxDayjs|StringundefinedDisables all dates (on the date-picker) that are set to after the max, note that if invalid date would be set by the input then the date picker value would be the max date but the input will show the user typed date.
isMonthDisabledCallback(Dayjs) => booleanundefinedCallback which should indicate if specific month is disabled (month selector).
monthBtnFormatStringDDThe month format of the month button in the calendar.
monthBtnFormatter(Dayjs) => StringundefinedThe formatter (callback function) of the month button in the calendar.
monthBtnCssClassCallback(Dayjs) => StringundefinedCallback which can add custom CSS classes to the month button in the calendar. Multiple classes can be returned with a space between them.
showMultipleYearsNavigationbooleanfalseIf set to true will show buttons to navigate by multiple years (10 by default)
multipleYearsNavigateBynumber10Number of years to navigate when showMultipleYearsNavigation is true
numOfMonthRows1, 2, 3, 4, 6, 124Number of rows to be shown on month calendar

Here is the list of APIs:

NameSignatureDescription
moveCalendarsBy(current: Dayjs, amount: number, granularity: dayjs.TimeUnit) => voidMoves calendar by given amount
moveCalendarTo`(to: Dayjs \String) => void`
toggleCalendarMode`(mode: day \month) => void`

Inline - Time Select

You can use the <dp-time-select> component to display the time select widget without an associated input box.

i.e.

<dp-time-select [(ngModel)]="selectedDate" [config]="config"></dp-time-select>  

Attributes:

NameTypeDefaultDescription
requiredBooleanundefinedThis is a validation rule, if there won't be any selected date then the containing form will be invalid.
minTimeDayjs|StringundefinedThis is a validation rule, if the selected date will be before minTime the containing form will be invalid. Note: if provided as string format configuration should be provided in the config object.
maxTimeDayjs|StringundefinedThis is a validation rule, if the selected date will be after maxTime the containing form will be invalid. Note: if provided as string format configuration should be provided in the config object.
themeString''Theme is a class added to the popup container (and inner components) - this will allow styling of the calendar when it's appended to outer element (for example - body). There is a built in theme named dp-material, you can find it in the demo.
configITimeSelectConfigSee BelowConfiguration object - see description below.

Attributes (Output):

NameEvent ArgumentsDescription
onChangeIDateThis event will be emitted when time is selected.

Configuration: In order to provide configurations to the time-select you need to pass it to the dp-time-select component:

<dp-time-select [(ngModel)]="selectedDate" [config]="config"></dp-time-select>  

Here are the available configurations:

NameTypeDefaultDescription
hours12FormatString"hh"The hours format of the time select when showTwentyFourHours is false.
hours24FormatString"HH"The hours format of the time select when showTwentyFourHours is true.
maxTimeDayjs|StringundefinedDisables arrow buttons on the time select that would make the time after the maxTime.
meridiemFormatString"A"The AM/PM format of the time select when showTwentyFourHours is false.
minTimeDayjs|StringundefinedDisables arrow buttons on the time select that would make the time before the minTime.
minutesFormatString"mm"The minutes format of the time select.
minutesIntervalnumber1The number of minutes that will be added/subtracted when clicking up/down arrows on the time select.
secondsFormatString"ss"The seconds format of the time select.
secondsIntervalnumber1The number of seconds that will be added/subtracted when clicking up/down arrows on the time select.
showSecondsbooleanfalseIf set to true will show seconds in the time select, otherwise, won't.
showTwentyFourHoursbooleanfalseIf set to true will show hours in 24 hour format. false will show hours in 12 hours format and append AM/PM to the end of the time select.
timeSeparatorString":"The separator that will be placed between hours and minutes and between minutes and seconds on the time select.

Inline - DayTime Calendar

You can use the <dp-day-time-calendar> component to display the calendar widget and time select widget without an associated input box.

i.e.

<dp-day-time-calendar [(ngModel)]="selectedDate" [config]="config"></dp-day-time-calendar>  

Attributes:

NameTypeDefaultDescription
requiredBooleanundefinedThis is a validation rule, if there won't be any selected date then the containing form will be invalid.
minDateDayjs|StringundefinedThis is a validation rule, if the selected date will be before minDate the containing form will be invalid. Note: if provided as string format configuration should be provided in the config object.
maxDateDayjs|StringundefinedThis is a validation rule, if the selected date will be after maxDate the containing form will be invalid. Note: if provided as string format configuration should be provided in the config object.
themeString''Theme is a class added to the popup container (and inner components) - this will allow styling of the calendar when it's appended to outer element (for example - body). There is a built in theme named dp-material, you can find it in the demo.
configIDatePickerConfigSee BelowConfiguration object - see description below.

Attributes (Output):

NameEvent ArgumentsDescription
onChangeIDateThis event will be emitted when time is selected.
onGoToCurrentvoidThis event will be emitted when click was made on go to current button.
onLeftNavvoidThis event will be emitted when click was made on left navigation button.
onRightNavvoidThis event will be emitted when click was made on right navigation button.

Configuration: In order to provide configurations to the day-time-calendar you need to pass it to the dp-day-time-calendar component:

<dp-day-time-calendar [(ngModel)]="selectedDate" [config]="config"></dp-day-time-calendar>  

Here are the available configurations:

NameTypeDefaultDescription
formatString"DD-MM-YYYY"If ngModel provided as String the format is required, this format also will be used as the input format style.
firstDayOfWeekString"su"The first day of the calendar's week. Should be one of: "su", "mo", "tu", "we", "th", "fr", "sa"
monthFormatString"MMM-YYYY"The date format of the day calendar, the one that seen above the calendar days. Will be overwritten if monthFormatter provided.
monthFormatter(Dayjs) => StringundefinedThe date formatter (callback function) of the day calendar, the one that seen above the calendar days.
yearFormatString"YYYY"The date format of the month calendar, the one that seen above the calendar months. Will be overwritten if yearFormatter provided. (available when enableMonthSelector is set to true).
yearFormatter(Dayjs) => StringundefinedThe date formatter (callback function) of the month calendar, the one that seen above the calendar months. (available when enableMonthSelector is set to true).
allowMultiSelectBooleanundefinedIf set to true will allow for choosing multiple dates. false will force a single selection. If undefined, the picker will attempt to guess based on the type of the input value.
minDayjs|StringundefinedDisables all dates (on the date-picker) that are set to before the min, note that if invalid date would be set by the input then the date picker value would be the min date but the input will show the user typed date.
maxDayjs|StringundefinedDisables all dates (on the date-picker) that are set to after the max, note that if invalid date would be set by the input then the date picker value would be the max date but the input will show the user typed date.
showNearMonthDaysBooleantrueWhether to show/hide next and previous month days.
showWeekNumbersBooleanfalseWhether to show/hide the week number of each week (iso week number).
enableMonthSelectorBooleantrueWhether to enable/disable the selection of a moth granularity picker.
isDayDisabledCallback(Dayjs) => booleanundefinedCallback which should indicate if specific day is disabled.
isMonthDisabledCallback(Dayjs) => booleanundefinedCallback which should indicate if specific month is disabled (month selector).
dayBtnFormatStringDDThe day format of the day button in the calendar.
dayBtnFormatter(Dayjs) => StringundefinedThe formatter (callback function) of the day button in the calendar.
dayBtnCssClassCallback(Dayjs) => StringundefinedCallback which can add custom CSS classes to the day button in the calendar. Multiple classes can be returned with a space between them.
monthBtnFormatStringDDThe month format of the month button in the calendar.
monthBtnFormatter(Dayjs) => StringundefinedThe formatter (callback function) of the month button in the calendar.
monthBtnCssClassCallback(Dayjs) => StringundefinedCallback which can add custom CSS classes to the month button in the calendar. Multiple classes can be returned with a space between them.
hours12FormatString"hh"The hours format of the time select when showTwentyFourHours is false.
hours24FormatString"HH"The hours format of the time select when showTwentyFourHours is true.
meridiemFormatString"A"The AM/PM format of the time select when showTwentyFourHours is false.
minutesFormatString"mm"The minutes format of the time select.
minutesIntervalNumber1The number of minutes that will be added/subtracted when clicking up/down arrows on the time select.
secondsFormatString"ss"The seconds format of the time select.
secondsIntervalNumber1The number of seconds that will be added/subtracted when clicking up/down arrows on the time select.
showSecondsbooleanfalseIf set to true will show seconds in the time select, otherwise, won't.
showTwentyFourHoursbooleanfalseIf set to true will show hours in 24 hour format. false will show hours in 12 hours format and append AM/PM to the end of the time select.
timeSeparatorString":"The separator that will be placed between hours and minutes and between minutes and seconds on the time select.
showMultipleYearsNavigationbooleanfalseIf set to true will show buttons to navigate by multiple years (10 by default).
multipleYearsNavigateByNumber10Number of years to navigate when showMultipleYearsNavigation is true.
hideInputContainerBooleanfalseWill hide the input element of any picker if set to true.
weekDayFormatStringdddThe format of the weekday name.
weekDayFormatter(Number) => StringundefinedYou can customize the value of any weekday with this configuration. The parameter of the callback will start with 0 as Sunday and so on.
numOfMonthRows1, 2, 3, 4, 6, 124Number of rows to be shown on month calendar

Directive

You can use the [dpDayPicker] directive to attach the picker to any component with an ngModel or a FormControl (using reactive forms).

i.e.

<input name="someName" [(ngModel)]="selectedDate" [dpDayPicker]="config" />  

or using reactive forms:

<input name="someName" formControlName="selectedDate" [dpDayPicker]="config" />  
<!-- OR -->  
<input name="someName" [formControl]="selectedDateFormControl" [dpDayPicker]="config" />  

or with @angular/material:

<md-input-container>  
 <input mdInput name="someName" [(ngModel)]="selectedDate" [dpDayPicker]="config" theme="dp-material" /></md-input-container>  

Attributes:

NameTypeDefaultDescription
mode'day'|'month'|'time'|'daytime''day'the type of the calender which will be displayed in the picker
themeString''Theme is a class added to the popup container (and inner components) - this will allow styling of the calendar when it's appended to outer element (for example - body). There is a built in theme named dp-material, you can find it in the demo.
configIDatePickerDirectiveConfigSee BelowConfiguration object - see description below.

Configuration: In order to provide configurations to the date-picker you need to pass it to the [dpDayPicker] directive:

<input [(ngModel)]="selectedDate" [dpDayPicker]="datePickerConfig" />  

The IDatePickerDirectiveConfig is identical to IDatePickerConfig above except that it lacks the showGoToCurrent property.

Here is the list of APIs:

NameSignatureDescription
moveCalendarTo(to: Dayjs | String) => voidMoves calendar to specific date

Compatibility

Internet Explorer 10:

Internet explorer 10 doesn't support hidden attribut, but you can use a css rule on data-hidden to hide date picker components:

[data-hidden="true"] {  
 display: none !important;}  

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

<a href="https://opencollective.com/angular-datepicker/sponsor/0/website" target="_blank"><img src="https://opencollective.com/angular-datepicker/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/angular-datepicker/sponsor/1/website" target="_blank"><img src="https://opencollective.com/angular-datepicker/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/angular-datepicker/sponsor/2/website" target="_blank"><img src="https://opencollective.com/angular-datepicker/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/angular-datepicker/sponsor/3/website" target="_blank"><img src="https://opencollective.com/angular-datepicker/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/angular-datepicker/sponsor/4/website" target="_blank"><img src="https://opencollective.com/angular-datepicker/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/angular-datepicker/sponsor/5/website" target="_blank"><img src="https://opencollective.com/angular-datepicker/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/angular-datepicker/sponsor/6/website" target="_blank"><img src="https://opencollective.com/angular-datepicker/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/angular-datepicker/sponsor/7/website" target="_blank"><img src="https://opencollective.com/angular-datepicker/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/angular-datepicker/sponsor/8/website" target="_blank"><img src="https://opencollective.com/angular-datepicker/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/angular-datepicker/sponsor/9/website" target="_blank"><img src="https://opencollective.com/angular-datepicker/sponsor/9/avatar.svg"></a>