Class IgxDatePickerComponent

Date Picker displays a popup calendar that lets users select a single date.

@igxmodule

IgxDatePickerModule

@igxtheme

igx-calendar-theme, igx-icon-theme

@igxgroup

Scheduling

@igxkeywords

datepicker, calendar, schedule, date

@example
<igx-date-picker [(ngModel)]="selectedDate"></igx-date-picker>

Hierarchy

  • IgxDatePickerComponent

Implements

  • IDatePicker
  • ControlValueAccessor
  • EditorProvider
  • OnInit
  • AfterViewInit
  • OnDestroy
  • AfterViewChecked

Constructors

constructor

  • new IgxDatePickerComponent(_overlayService: IgxOverlayService, element: ElementRef, _cdr: ChangeDetectorRef, _moduleRef: NgModuleRef<any>, _injector: Injector, _renderer: Renderer2): IgxDatePickerComponent

Properties

cancelButtonLabel

cancelButtonLabel: string

*Gets/Sets the cancel button's label.

@example
<igx-date-picker cancelButtonLabel="Close" todayButtonLabel="Today"></igx-date-picker>

disabled

disabled: boolean

Enables/Disables the IgxDatePickerComponent.

@example
<igx-date-picker [disabled]="'true'" cancelButtonLabel="cancel" todayButtonLabel="today"></igx-date-picker>

element

element: ElementRef

formatter

formatter: function

Gets/Sets a custom formatter function on the selected or passed date.

@example
<igx-date-picker [value]="date" [formatter]="formatter"></igx-date-picker>

Type declaration

    • (val: Date): string
    • Parameters

      • val: Date

      Returns string

hideOutsideDays

hideOutsideDays: boolean

Gets/Sets whether the inactive dates will be hidden.

@remarks

Apllies to dates that are out of the current month. Default value is false.

@example
<igx-date-picker [hideOutsideDays]="true"></igx-date-picker>
@example
let hideOutsideDays = this.datePicker.hideOutsideDays;

id

id: string = `igx-date-picker-${NEXT_ID++}`

Gets/Sets the value of id attribute.

@remarks

If not provided it will be automatically generated.

@example
<igx-date-picker [id]="'igx-date-picker-3'" cancelButtonLabel="cancel" todayButtonLabel="today"></igx-date-picker>

isSpinLoop

isSpinLoop: boolean = true

Gets/Sets whether date should spin continuously or stop when min/max is reached.

@example
<igx-date-picker [isSpinLoop]="false"></igx-date-picker>

label

label: string = "Date"

Gets/Sets the IgxDatePickerComponent label.

@remarks

The default label is 'Date'.

@example
<igx-date-picker [label]="Calendar"></igx-date-picker>

labelVisibility

labelVisibility: boolean = true

Gets/Sets the IgxDatePickerComponent label visibility.

@remarks

By default the visibility is set to true.

@example

<igx-date-picker [labelVisibility]="false">

locale

locale: "en"

Gets/Sets the locales.

@remarks

Default locale is en.

@example
<igx-date-picker locale="ja-JP" [value]="date"></igx-date-picker>

mask

mask: string

Gets/Sets the date mask of the IgxDatePickerComponent when in editable dropdown mode.

@example
let mask = this.datePicker.mask;

mode

mode: InteractionMode = InteractionMode.Dialog

Gets/Sets the interaction mode - dialog or drop down.

@example
<igx-date-picker mode="dropdown"></igx-date-picker>

monthsViewNumber

monthsViewNumber: number = 1

Gets/Sets the number of month views displayed.

@remarks

Default value is 1.

@example
<igx-date-picker [monthsViewNumber]="2"></igx-date-picker>
@example
let monthViewsDisplayed = this.datePicker.monthsViewNumber;

onClosed

onClosed: EventEmitter<IgxDatePickerComponent> = new EventEmitter<IgxDatePickerComponent>()

Emitted after the IgxDatePickerComponent is closed.

onClosing

onClosing: EventEmitter<CancelableBrowserEventArgs & IBaseEventArgs> = new EventEmitter<CancelableBrowserEventArgs & IBaseEventArgs>()

Emitted when the IgxDatePickerComponent is being closed.

onDisabledDate

onDisabledDate: EventEmitter<IDatePickerDisabledDateEventArgs> = new EventEmitter<IDatePickerDisabledDateEventArgs>()

Emitted when the user types/spins to a disabled date in the date-picker editor.

@example
<igx-date-picker (onDisabledDate)="onDisabledDate($event)"></igx-date-picker>

onOpened

onOpened: EventEmitter<IgxDatePickerComponent> = new EventEmitter<IgxDatePickerComponent>()

Emitted when the IgxDatePickerComponent calendar is opened.

onSelection

onSelection: EventEmitter<Date> = new EventEmitter<Date>()

Emitted when selection is made in the calendar.

@example
<igx-date-picker (onSelection)="selection($event)"></igx-date-picker>

onValidationFailed

onValidationFailed: EventEmitter<IDatePickerValidationFailedEventArgs> = new EventEmitter<IDatePickerValidationFailedEventArgs>()

Emitted when the user types/spins invalid date in the date-picker editor.

@example
<igx-date-picker (onValidationFailed)="onValidationFailed($event)"></igx-date-picker>

outlet

outlet: IgxOverlayOutletDirective | ElementRef

Gets/Sets the container used for the popup element.

@remarks

outlet is an instance of IgxOverlayOutletDirective or an ElementRef.

@example
<div igxOverlayOutlet #outlet="overlay-outlet"></div>
//..
<igx-date-picker [outlet]="outlet"></igx-date-picker>
//..

todayButtonLabel

todayButtonLabel: string

Gets/Sets the today button's label.

@example
<igx-date-picker cancelButtonLabel="cancel" todayButtonLabel="Tomorrow"></igx-date-picker>

valueChange

valueChange: EventEmitter<Date> = new EventEmitter<Date>()

Emitted when date picker value is changed.

@example
<igx-date-picker (valueChange)="valueChanged($event)" mode="dropdown"></igx-date-picker>

vertical

vertical: boolean = false

Gets/Sets the orientation of the IgxDatePickerComponent header.

@example
<igx-date-picker [vertical]="'true'" cancelButtonLabel="cancel" todayButtonLabel="today"></igx-date-picker>

weekStart

weekStart: WEEKDAYS | number = WEEKDAYS.SUNDAY

Gets/Sets on which day the week starts.

@example
<igx-date-picker [weekStart]="WEEKDAYS.FRIDAY" cancelButtonLabel="cancel" todayButtonLabel="today"></igx-date-picker>

Accessors

context

  • get context(): object

disabledDates

displayData

  • get displayData(): string

dropDownOverlaySettings

format

  • get format(): string
  • set format(format: string): void

formatOptions

formatViews

modalOverlaySettings

specialDates

template

  • get template(): TemplateRef<any>

value

  • get value(): Date
  • set value(date: Date): void

Methods

_updateValidityOnBlur

  • _updateValidityOnBlur(): void

deselectDate

  • deselectDate(): void

ngAfterViewChecked

  • ngAfterViewChecked(): void

openDialog

  • openDialog(): void

selectDate

  • selectDate(date: Date): void

triggerTodaySelection

  • triggerTodaySelection(): void