Class IgxDateRangePickerComponent

Provides the ability to select a range of dates from a calendar UI or editable inputs.

IgxDateRangeModule

igx-input-group-theme, igx-calendar-theme, igx-date-range-picker-theme

date, range, date range, date picker

scheduling

It displays the range selection in a single or two input fields. The default template displays a single readonly input field while projecting igx-date-range-start and igx-date-range-end displays two editable input fields.

<igx-date-range-picker mode="dropdown"></igx-date-range-picker>

Hierarchy

Hierarchy

  • PickerBaseDirective
    • IgxDateRangePickerComponent

Implements

  • OnChanges
  • OnInit
  • AfterViewInit
  • OnDestroy
  • ControlValueAccessor
  • Validator

Constructors

Properties

closed: EventEmitter<IBaseEventArgs> = ...

Emitted after the calendar has closed.

<igx-date-picker (closed)="handleClosed($event)"></igx-date-picker>
closing: EventEmitter<IBaseCancelableBrowserEventArgs> = ...

Emitted when the calendar has started closing, cancelable.

<igx-date-picker (closing)="handleClosing($event)"></igx-date-picker>
disabled: boolean = false

Enables or disables the picker.

<igx-date-picker [disabled]="'true'"></igx-date-picker>
displayFormat: string

The format used when editable inputs are not focused.

Uses Angular's DatePipe.

<igx-date-range-picker displayFormat="EE/M/yy"></igx-date-range-picker>
displayMonthsCount: number = 2

The number of displayed month views.

Default is 2.

<igx-date-range-picker [displayMonthsCount]="3"></igx-date-range-picker>
element: ElementRef<any>
formatter: ((val: DateRange) => string)

A custom formatter function, applied on the selected or passed in date.

private dayFormatter = new Intl.DateTimeFormat("en", { weekday: "long" });
private monthFormatter = new Intl.DateTimeFormat("en", { month: "long" });

public formatter(date: Date): string {
return `${this.dayFormatter.format(date)} - ${this.monthFormatter.format(date)} - ${date.getFullYear()}`;
}
<igx-date-range-picker [formatter]="formatter"></igx-date-range-picker>

Type declaration

    • (val): string
    • Parameters

      Returns string

hideOutsideDays: boolean

Gets/Sets whether dates that are not part of the current month will be displayed.

Default value is false.

<igx-date-range-picker [hideOutsideDays]="true"></igx-date-range-picker>
inputFormat: string

The expected user input format and placeholder.

Default is "'MM/dd/yyyy'"

<igx-date-range-picker inputFormat="dd/MM/yy"></igx-date-range-picker>
mode: PickerInteractionMode = PickerInteractionMode.DropDown

Can be dropdown with editable input field or dialog with readonly input field.

Default mode is dropdown

<igx-date-picker mode="dialog"></igx-date-picker>
opened: EventEmitter<IBaseEventArgs> = ...

Emitted after the calendar has opened.

<igx-date-picker (opened)="handleOpened($event)"></igx-date-picker>
opening: EventEmitter<IBaseCancelableBrowserEventArgs> = ...

Emitted when the calendar has started opening, cancelable.

<igx-date-picker (opening)="handleOpening($event)"></igx-date-picker>
outlet: ElementRef<any> | IgxOverlayOutletDirective

Gets/Sets the container used for the popup element.

outlet is an instance of IgxOverlayOutletDirective or an ElementRef.

<div igxOverlayOutlet #outlet="overlay-outlet"></div>
//..
<igx-date-range-picker [outlet]="outlet"></igx-date-range-picker>
//..
overlaySettings: OverlaySettings

Custom overlay settings that should be used to display the calendar.

<igx-date-range-picker [overlaySettings]="customOverlaySettings"></igx-date-range-picker>
placeholder: string = ''

Sets the placeholder for single-input IgxDateRangePickerComponent.

<igx-date-range-picker [placeholder]="'Choose your dates'"></igx-date-range-picker>
showWeekNumbers: boolean = false

Show/hide week numbers

Default is false.

<igx-date-range-picker [showWeekNumbers]="true"></igx-date-range-picker>
tabIndex: string | number

Gets/Sets the default template editor's tabindex.

<igx-date-picker [tabIndex]="1"></igx-date-picker>
valueChange: EventEmitter<DateRange> = ...

Emitted when the picker's value changes. Used for two-way binding.

<igx-date-range-picker [(value)]="date"></igx-date-range-picker>

Accessors

Methods

  • Selects a range of dates. If no endDate is passed, range is 1 day (only startDate)

    public selectFiveDayRange() {
    const today = new Date();
    const inFiveDays = new Date(new Date().setDate(today.getDate() + 5));
    this.dateRange.select(today, inFiveDays);
    }

    Parameters

    • startDate: Date
    • endDate: Date

    Returns void