# Angular DateRangePicker Component

Deprecated, use DatePicker with presets. DateRangePicker selects a range of dates: two months side by side, presets such as Today, Last 7 days or Last month next to them, and an input where the range can be typed. The presets follow the first day of the week of the locale, the active one is highlighted, custom presets can be added, and the value is a [start, end] pair of dates for template-driven, reactive and Signal Forms.

## Deprecated

DateRangePicker is deprecated since 22.15.0 and will be removed in 23. Use DatePicker with selectionMode="range" and the presets input instead, as shown in the Presets section of DatePicker : it takes the same preset keys and custom presets, and the datePresets key of the locale translates both components. DateRangePicker keeps working until then.

## Basic

DateRangePicker is bound with ngModel to a [start, end] pair of dates, null while there is no range. The button opens two months side by side with a list of presets next to them: pick a preset, or click the first and the last day in the calendars. The range can also be typed in the input, such as 02/12/2026 – 09/12/2026 with the date format of the locale.

```typescript
import { Component } from '@angular/core';
import { DatePipe } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-col items-center gap-3">
            <p-date-range-picker [(ngModel)]="range" ariaLabel="Period" />
            <span class="text-sm font-mono">Value: {{ range ? (range[0] | date: 'yyyy-MM-dd') + ' → ' + (range[1] | date: 'yyyy-MM-dd') : 'null' }}</span>
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DatePipe, DateRangePickerModule]
})
export class DaterangepickerBasicDemo {
    range: Date[] | null = null;
}
```

## Presets

The presets input chooses the built-in presets and their order: today , yesterday , last7Days , last30Days , last90Days , thisWeek , lastWeek , monthToDate , thisMonth , lastMonth , yearToDate , thisYear and lastYear . They are computed from the current day each time the panel opens, and the weeks start on the firstDayOfWeek of the locale, or of the input of the same name, here Monday. The preset that matches the range is highlighted, and the Custom range item when none does; an empty array hides the list.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule, type DateRangePresetKey } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-col items-center gap-3">
            <p-date-range-picker [(ngModel)]="range" [presets]="presets" [firstDayOfWeek]="1" ariaLabel="Period" />
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule]
})
export class DaterangepickerPresetsDemo {
    range: Date[] | null = null;

    presets: DateRangePresetKey[] = ['today', 'yesterday', 'thisWeek', 'lastWeek', 'last30Days', 'monthToDate', 'lastMonth', 'yearToDate', 'lastYear'];
}
```

## Custom Presets

A custom preset has a label and a range : a pair of dates, or a function that computes them when the list opens and when the preset is picked. Custom presets mix with the keys of the built-in ones, in the order of the array, and showCustomPreset removes the Custom range item.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule, type DateRangePreset, type DateRangePresetKey } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-col items-center gap-3">
            <p-date-range-picker [(ngModel)]="range" [presets]="presets" [showCustomPreset]="false" ariaLabel="Reporting period" />
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule]
})
export class DaterangepickerCustompresetsDemo {
    range: Date[] | null = null;

    presets: (DateRangePresetKey | DateRangePreset)[] = [
        'today',
        { label: 'Next 7 days', range: () => [new Date(), this.addDays(new Date(), 6)] },
        { label: 'This quarter', range: () => this.quarter(0) },
        { label: 'Last quarter', range: () => this.quarter(-1) },
        'thisYear'
    ];

    addDays(date: Date, days: number): Date {
        return new Date(date.getFullYear(), date.getMonth(), date.getDate() + days);
    }

    quarter(offset: number): [Date, Date] {
        const today = new Date();
        const first = Math.floor(today.getMonth() / 3) * 3 + offset * 3;
        return [new Date(today.getFullYear(), first, 1), new Date(today.getFullYear(), first + 3, 0)];
    }
}
```

## Number of Months

Two months are displayed side by side by default, the end of the range on the last one. numberOfMonths changes the number of months; on screens narrower than 768px, a single month is displayed and the presets move below the calendar.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-col items-center gap-3">
            <p-date-range-picker [(ngModel)]="range1" [numberOfMonths]="1" ariaLabel="Period, one month" />
            <p-date-range-picker [(ngModel)]="range2" [numberOfMonths]="3" ariaLabel="Period, three months" />
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule]
})
export class DaterangepickerMonthsDemo {
    range1: Date[] | null = null;

    range2: Date[] | null = null;
}
```

## Min and Max Dates

minDate and maxDate bound the days that can be picked, typed or reached by a preset: a preset that goes past them is cut to them, and one entirely outside of them is disabled. disabledDates and disabledDays disable single days or days of the week. Here the range has to be in the last 90 days.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-col items-center gap-3">
            <p-date-range-picker [(ngModel)]="range" [minDate]="minDate" [maxDate]="maxDate" [presets]="['today', 'last7Days', 'last30Days', 'thisMonth', 'lastMonth', 'thisYear']" ariaLabel="Period in the last 90 days" />
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule]
})
export class DaterangepickerMinmaxDemo {
    range: Date[] | null = null;

    maxDate = new Date();

    minDate = new Date(this.maxDate.getFullYear(), this.maxDate.getMonth(), this.maxDate.getDate() - 89);
}
```

## Time

With showTime , the calendars have a time picker for the date picked last and the input shows the times; the panel then stays open after the second date so that the times can be changed. A preset ends at 23:59. hourFormat switches to a 12 hour clock.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-col items-center gap-3">
            <p-date-range-picker [(ngModel)]="range" showTime ariaLabel="Period with times" />
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule]
})
export class DaterangepickerTimeDemo {
    range: Date[] | null = null;
}
```

## Inline

With inline , the presets and the calendars are displayed in the page, without an input.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex justify-center overflow-x-auto">
            <p-date-range-picker [(ngModel)]="range" inline ariaLabel="Period" />
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule]
})
export class DaterangepickerInlineDemo {
    range: Date[] | null = null;
}
```

## Template

The preset template replaces the content of a preset, with the preset, whether it is active and whether it is focused ; the range of a built-in or custom preset is in preset.range . The header and footer templates add content above and below the panel, and dropdownicon replaces the icon of the button.

```typescript
import { Component } from '@angular/core';
import { DatePipe } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-col items-center gap-3">
            <p-date-range-picker [(ngModel)]="range" dateFormat="M d" ariaLabel="Period">
                <ng-template #preset let-preset let-active="active">
                    <span class="flex items-center justify-between gap-4 w-full">
                        <span>{{ preset.label }}</span>
                        @if (preset.range) {
                            <span class="text-xs" [class.opacity-80]="!active">{{ preset.range[0] | date: 'MMM d' }}</span>
                        }
                    </span>
                </ng-template>
                <ng-template #footer>
                    <p class="m-0 text-sm text-muted-color">The range is used in all the charts of the dashboard.</p>
                </ng-template>
            </p-date-range-picker>
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DatePipe, DateRangePickerModule]
})
export class DaterangepickerTemplateDemo {
    range: Date[] | null = null;
}
```

## Labels and Locale

The texts of the component, the names of the presets and the announcements included, are merged from the labels input with the English defaults. The names of the days and of the months, the date format and the first day of the week come from the locale of the configuration, set with setTranslation ; dateFormat , firstDayOfWeek and rangeSeparator override them for one component.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule, type DateRangePickerLabels } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-col items-center gap-3">
            <p-date-range-picker [(ngModel)]="range" dateFormat="dd/mm/yy" [firstDayOfWeek]="1" rangeSeparator=" au " [labels]="labels" ariaLabel="Période" />
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule]
})
export class DaterangepickerLabelsDemo {
    range: Date[] | null = null;

    labels: Partial<DateRangePickerLabels> = {
        chooseRangeLabel: 'Choisir une période',
        presetsLabel: 'Périodes',
        custom: 'Personnalisée',
        today: "Aujourd'hui",
        last7Days: '7 derniers jours',
        thisWeek: 'Cette semaine',
        thisMonth: 'Ce mois-ci',
        lastMonth: 'Le mois dernier',
        thisYear: 'Cette année',
        rangeSelectedMessage: 'Période choisie : du {0} au {1}',
        presetSelectedMessage: '{2} : du {0} au {1}',
        startSelectedMessage: 'Début le {0}, choisissez la fin',
        clearedMessage: 'Période effacée'
    };
}
```

## Clear

With showClear , a button clears the range when there is one. Emptying the input does the same.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-col items-center gap-3">
            <p-date-range-picker [(ngModel)]="range" showClear ariaLabel="Period" />
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule]
})
export class DaterangepickerClearDemo {
    range: Date[] | null = [new Date(new Date().getFullYear(), new Date().getMonth(), 1), new Date()];
}
```

## Sizes

DateRangePicker provides small and large sizes as alternatives to the base.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-col items-center gap-3">
            <p-date-range-picker [(ngModel)]="range1" size="small" placeholder="Small" ariaLabel="Small" />
            <p-date-range-picker [(ngModel)]="range2" placeholder="Normal" ariaLabel="Normal" />
            <p-date-range-picker [(ngModel)]="range3" size="large" placeholder="Large" ariaLabel="Large" />
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule]
})
export class DaterangepickerSizesDemo {
    range1: Date[] | null = null;

    range2: Date[] | null = null;

    range3: Date[] | null = null;
}
```

## Filled

Specify the variant property as filled to display the component with a higher visual emphasis than the default outlined style.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-col items-center gap-3">
            <p-date-range-picker [(ngModel)]="range" variant="filled" ariaLabel="Period" />
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule]
})
export class DaterangepickerFilledDemo {
    range: Date[] | null = null;
}
```

## Disabled

When the disabled property is present, the range cannot be changed.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-col items-center gap-3">
            <p-date-range-picker [(ngModel)]="range" disabled ariaLabel="Period" />
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule]
})
export class DaterangepickerDisabledDemo {
    range: Date[] | null = [new Date(new Date().getFullYear(), 0, 1), new Date(new Date().getFullYear(), 0, 31)];
}
```

## Invalid

The invalid state is applied using the invalid property to indicate failed validation, here while there is no range.

```typescript
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';

@Component({
    template: `
        <div class="card flex flex-wrap justify-center gap-4">
            <p-date-range-picker [(ngModel)]="range1" [invalid]="!range1" ariaLabel="Period" />
            <p-date-range-picker [(ngModel)]="range2" [invalid]="!range2" variant="filled" ariaLabel="Period, filled" />
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule]
})
export class DaterangepickerInvalidDemo {
    range1: Date[] | null = null;

    range2: Date[] | null = null;
}
```

## Forms: Template Driven

The value is a [start, end] pair of dates once a whole range is picked, typed or set by a preset, and null otherwise: a start date alone is not a value, so required works as on the other fields. Link the message with ariaDescribedBy so that it is read with the field.

```typescript
import { Component, inject } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';
import { MessageService } from '@exhaustive-ui/core/api';
import { ToastModule } from '@exhaustive-ui/core/toast';
import { MessageModule } from '@exhaustive-ui/core/message';
import { ButtonModule } from '@exhaustive-ui/core/button';

@Component({
    template: `
        <p-toast />
        <div class="card flex justify-center">
            <form #exampleForm="ngForm" (ngSubmit)="onSubmit(exampleForm)" class="flex flex-col gap-4 w-full md:w-[30rem]">
                <div class="flex flex-col gap-2">
                    <label for="period-td" class="font-medium">Period</label>
                    <p-date-range-picker #model="ngModel" [(ngModel)]="range" name="range" inputId="period-td" ariaDescribedBy="period-td-error" fluid [invalid]="model.invalid && (model.touched || exampleForm.submitted)" required />
                    @if (model.invalid && (model.touched || exampleForm.submitted)) {
                        <p-message id="period-td-error" severity="error" size="small" variant="simple">Period is required.</p-message>
                    }
                </div>
                <button pButton severity="secondary" type="submit" class="self-start"><span pButtonLabel>Submit</span></button>
            </form>
        </div>
    `,
    standalone: true,
    imports: [FormsModule, DateRangePickerModule, ToastModule, MessageModule, ButtonModule],
    providers: [MessageService]
})
export class DaterangepickerTemplatedrivenformsDemo {
    messageService = inject(MessageService);

    range: Date[] | null = null;

    onSubmit(form: any) {
        if (form.valid) {
            this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form Submitted', life: 3000 });
            form.resetForm();
        }
    }
}
```

## Reactive Forms

DateRangePicker can also be used with reactive forms, through the formControlName property. setValue takes a pair of dates, or of ISO strings, and a reversed pair is put in order.

```typescript
import { Component, inject } from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';
import { MessageService } from '@exhaustive-ui/core/api';
import { ToastModule } from '@exhaustive-ui/core/toast';
import { MessageModule } from '@exhaustive-ui/core/message';
import { ButtonModule } from '@exhaustive-ui/core/button';

@Component({
    template: `
        <p-toast />
        <div class="card flex justify-center">
            <form [formGroup]="exampleForm" (ngSubmit)="onSubmit()" class="flex flex-col gap-4 w-full md:w-[30rem]">
                <div class="flex flex-col gap-2">
                    <label for="period-rf" class="font-medium">Period</label>
                    <p-date-range-picker formControlName="period" inputId="period-rf" ariaDescribedBy="period-rf-error" fluid [invalid]="isInvalid('period')" />
                    @if (isInvalid('period')) {
                        <p-message id="period-rf-error" severity="error" size="small" variant="simple">Period is required.</p-message>
                    }
                </div>
                <button pButton severity="secondary" type="submit" class="self-start"><span pButtonLabel>Submit</span></button>
            </form>
        </div>
    `,
    standalone: true,
    imports: [ReactiveFormsModule, DateRangePickerModule, ToastModule, MessageModule, ButtonModule],
    providers: [MessageService]
})
export class DaterangepickerReactiveformsDemo {
    private fb = inject(FormBuilder);

    messageService = inject(MessageService);

    exampleForm: FormGroup;

    formSubmitted: boolean = false;

    constructor() {
        this.exampleForm = this.fb.group({
            period: [null, Validators.required]
        });
    }

    onSubmit() {
        this.formSubmitted = true;
        if (this.exampleForm.valid) {
            this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form is submitted', life: 3000 });
            this.exampleForm.reset();
            this.formSubmitted = false;
        }
    }

    isInvalid(controlName: string) {
        const control = this.exampleForm.get(controlName);
        return control?.invalid && (control.touched || this.formSubmitted);
    }
}
```

## Signal Forms

DateRangePicker can also be used with Angular Signal Forms . The [formField] directive binds the component to a field holding a pair of dates or null, and sets its invalid and touched states, so it is styled as invalid once the field is touched or the form is submitted.

```typescript
import { Component, inject, signal } from '@angular/core';
import { form, FormField, required, submit } from '@angular/forms/signals';
import { DateRangePickerModule } from '@exhaustive-ui/core/daterangepicker';
import { MessageService } from '@exhaustive-ui/core/api';
import { ToastModule } from '@exhaustive-ui/core/toast';
import { MessageModule } from '@exhaustive-ui/core/message';
import { ButtonModule } from '@exhaustive-ui/core/button';

@Component({
    template: `
        <p-toast />
        <div class="card flex justify-center">
            <form novalidate (submit)="onSubmit($event)" class="flex flex-col gap-4 w-full md:w-[30rem]">
                <div class="flex flex-col gap-2">
                    <label for="period-sf" class="font-medium">Period</label>
                    <p-date-range-picker [formField]="reportForm.period" inputId="period-sf" ariaDescribedBy="period-sf-error" fluid />
                    @let period = reportForm.period();
                    @if (period.invalid() && period.touched()) {
                        <p-message id="period-sf-error" severity="error" size="small" variant="simple">Period is required.</p-message>
                    }
                </div>
                <button pButton severity="secondary" type="submit" class="self-start"><span pButtonLabel>Submit</span></button>
            </form>
        </div>
    `,
    standalone: true,
    imports: [FormField, DateRangePickerModule, ButtonModule, ToastModule, MessageModule],
    providers: [MessageService]
})
export class DaterangepickerSignalformsDemo {
    messageService = inject(MessageService);

    model = signal<{ period: Date[] | null }>({ period: null });

    reportForm = form(this.model, (f) => {
        required(f.period);
    });

    onSubmit(event: Event) {
        event.preventDefault();
        submit(this.reportForm, async () => {
            this.messageService.add({ severity: 'success', summary: 'Success', detail: 'Form is submitted', life: 3000 });
            this.reportForm().reset({ period: null });
        });
    }
}
```

## Accessibility

Screen Reader The input has the combobox role with aria-haspopup="dialog" , aria-expanded and aria-controls , like the button that opens the panel, whose accessible name is the chooseRangeLabel text. Label the input with a label element pointing at inputId , with ariaLabelledBy or with ariaLabel ; without any of them it is named by the inputLabel text. Link an error message with ariaDescribedBy ; aria-invalid follows the invalid state. The panel is a dialog named by the chooseRangeLabel text, a group when the component is inline. The presets are a listbox named by the presetsLabel text: the preset that matches the range, or the custom range item, has aria-selected="true" , the option with the keyboard focus is given by aria-activedescendant , and presets outside of the minimum and maximum dates have aria-disabled="true" . The calendars are the grids of DatePicker, each day named by its full date. A polite live region announces the range selected, with the name of the preset when it comes from one, that the start date is picked and the end date is expected, and that the range is cleared. All the texts can be replaced, or translated, with the labels input.

## Date Range Picker

DateRangePicker selects a range of dates: two months side by side, a list of presets such as Today, Last 7 days or Last month next to them, and an input where the range can be typed. The value is a  `[start, end]`  pair of dates.

### Props

| Name | Type | Default | Description |
|------|------|---------|-------------|
| dt | Object | undefined | Defines scoped design tokens of the component. |
| unstyled | boolean | undefined | Indicates whether the component should be rendered without styles. |
| pt | DateRangePickerPassThrough | undefined | Used to pass attributes to DOM elements inside the component. |
| ptOptions | PassThroughOptions | undefined | Used to configure passthrough(pt) options of the component. |
| required | boolean | false | There must be a value (if set). |
| invalid | boolean | false | When present, it specifies that the component should have invalid state style. |
| touched | boolean | undefined | Whether the field has been touched. Signal Forms sets it through  `[formField]` : the invalid style and  `aria-invalid`  then wait until the field is touched, or the form is submitted, like the error messages. Left unset,  `invalid`  applies at once. |
| $invalid | Signal<boolean> | - | The invalid state shown by the component:  `invalid` , once the field is touched when  `touched`  is set; undefined when  `invalid`  is unset. |
| disabled | boolean | false | When present, it specifies that the component should have disabled state style. |
| name | string | undefined | When present, it specifies that the name of the input. |
| fluid | boolean | false | Spans 100% width of the container when enabled. |
| variant | "filled" \| "outlined" | 'outlined' | Specifies the input variant of the component. |
| size | "small" \| "large" | undefined | Specifies the size of the component. |
| inputSize | number | undefined | Specifies the visible width of the input element in characters. |
| pattern | string | undefined | Specifies the value must match the pattern. |
| min | number | undefined | The value must be greater than or equal to the value. |
| max | number | undefined | The value must be less than or equal to the value. |
| step | number | undefined | Unless the step is set to the any literal, the value must be min + an integral multiple of the step. |
| minlength | number | undefined | The number of characters (code points) must not be less than the value of the attribute, if non-empty. |
| maxlength | number | undefined | The number of characters (code points) must not exceed the value of the attribute. |
| presets | (DateRangePresetKey \| DateRangePreset)[] | ['today', 'last7Days', 'thisWeek', 'thisMonth', 'lastMonth', 'thisYear'] | Presets listed next to the calendars: keys of built-in presets and custom presets with a label and a range. An empty array hides the list. |
| showCustomPreset | boolean | true | Whether the list ends with a custom range item, active when the range matches no preset, that moves the focus to the calendars. |
| numberOfMonths | number | 2 | Number of months displayed side by side; a single month is displayed on screens narrower than 768px. |
| minDate | Date | - | The first day that can be selected. |
| maxDate | Date | - | The last day that can be selected. |
| disabledDates | Date[] | - | Days that cannot be selected. |
| disabledDays | number[] | - | Days of the week that cannot be selected, 0 for Sunday to 6 for Saturday. |
| firstDayOfWeek | number | - | First day of the week, 0 for Sunday to 6 for Saturday. Defaults to the  `firstDayOfWeek`  of the locale; the week presets follow it. |
| dateFormat | string | - | Format of the dates in the input, with the DatePicker tokens such as  `dd/mm/yy` . Defaults to the  `dateFormat`  of the locale. |
| rangeSeparator | string | ' – ' | Text between the two dates in the input. Typing an en dash, an em dash, a hyphen between spaces or  `to`  also works. |
| showTime | boolean | false | Whether the calendars have a time picker; the input then shows the times as well. |
| hourFormat | "12" \| "24" | '24' | Format of the hours,  `12`  or  `24` . |
| showWeek | boolean | false | Whether the calendars show the week numbers. |
| inline | boolean | false | Displays the presets and the calendars without an input and an overlay. |
| showIcon | boolean | true | Whether the button that opens the panel is displayed. |
| showClear | boolean | false | Whether a button that clears the range is displayed when there is one. |
| showOnClick | boolean | true | Whether the panel opens when the input is clicked. |
| hideOnRangeSelect | boolean | true | Whether the panel closes once a range is selected. It stays open with the time picker, so that the times can be changed. |
| readonlyInput | boolean | false | When present, the range cannot be typed, only picked. |
| placeholder | string | - | Placeholder of the input. |
| inputId | string | - | Identifier of the input, for a label element. |
| tabindex | number | - | Index of the input in the tab order. |
| ariaLabel | string | - | Accessible name of the input. |
| ariaLabelledBy | string | - | Identifier of the element that labels the input. |
| ariaDescribedBy | string | - | Identifiers of the elements that describe the input, such as an error message. |
| appendTo | any | - | Target element to attach the panel to,  `'body'`  or  `'self'` . |
| overlayOptions | OverlayOptions | - | Options of the overlay of the panel. |
| panelStyleClass | string | - | Style class of the panel. |
| labels | Partial<DateRangePickerLabels> | - | Texts of the component, merged with the English defaults. |
| range | WritableSignal<DateRange> | signal<DateRange | null>(null) | The selected range, null when there is none. |
| presetOptions | Signal<DateRangePickerPresetOption[]> | - | The presets of the list, with their ranges computed for the current day. |
| activePresetKey | Signal<string> | - | Key of the preset that matches the selected range,  `custom`  when none matches, null without a range. |

### Emits

| Name | Parameters | Description |
|------|------------|-------------|
| onRangeSelect | event: DateRangePickerSelectEvent | Callback to invoke when a range is selected: a preset, a second date in the calendars or a typed range. |
| onPresetSelect | event: DateRangePickerPresetSelectEvent | Callback to invoke when a preset of the list is picked, the custom range item included. |
| onClear | event: Event | Callback to invoke when the range is cleared. |
| onShow | value: void | Callback to invoke when the panel opens. |
| onHide | value: void | Callback to invoke when the panel closes. |
| onFocus | event: FocusEvent | Callback to invoke when the component receives the focus. |
| onBlur | event: FocusEvent | Callback to invoke when the component loses the focus. |

### Templates

| Name | Type | Description |
|------|------|-------------|
| preset | TemplateRef<DateRangePickerPresetTemplateContext> | Custom content of a preset. |
| header | TemplateRef<void> | Custom content of the top of the panel. |
| footer | TemplateRef<void> | Custom content of the bottom of the panel. |
| dropdownicon | TemplateRef<void> | Custom icon of the button that opens the panel. |

### Methods

| Name | Parameters | Return Type | Description |
|------|------------|-------------|-------------|
| show | focusPanel: boolean | void | Opens the panel. |
| hide | focusInput: boolean | void | Closes the panel. |
| focus |  | void | Moves the focus to the input, or to the presets when the component is inline. |
| clear | event: Event | void | Clears the range. |
| selectPreset | key: string, event: Event | void | Selects a preset of the list by its key. |

## Pass Through Options

| Name | Type | Description |
|------|------|-------------|
| host | PassThroughOption<HTMLElement, I> | Used to pass attributes to the host's DOM element. |
| root | PassThroughOption<HTMLElement, I> | Used to pass attributes to the root's DOM element. |
| pcInputText | InputTextPassThrough | Used to pass attributes to the InputText of the range. |
| clearButton | PassThroughOption<HTMLButtonElement, I> | Used to pass attributes to the clear button. |
| dropdown | PassThroughOption<HTMLButtonElement, I> | Used to pass attributes to the button that opens the panel. |
| dropdownIcon | PassThroughOption<SVGElement, I> | Used to pass attributes to the icon of the button that opens the panel. |
| pcOverlay | OverlayPassThrough | Used to pass attributes to the Overlay component. |
| panel | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the panel's DOM element. |
| presets | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the container of the presets. |
| presetList | PassThroughOption<HTMLUListElement, I> | Used to pass attributes to the list of the presets. |
| preset | PassThroughOption<HTMLLIElement, I> | Used to pass attributes to a preset of the list. |
| calendars | PassThroughOption<HTMLDivElement, I> | Used to pass attributes to the container of the calendars. |
| pcDatePicker | DatePickerPassThrough | Used to pass attributes to the DatePicker component of the calendars. |

## Theming

### CSS Classes

| Class | Description |
|-------|-------------|
| p-daterangepicker | Class name of the root element |
| p-daterangepicker-input | Class name of the input element |
| p-daterangepicker-clear-button | Class name of the clear button |
| p-daterangepicker-dropdown | Class name of the button that opens the panel |
| p-daterangepicker-panel | Class name of the panel |
| p-daterangepicker-header | Class name of the header of the panel |
| p-daterangepicker-content | Class name of the content of the panel |
| p-daterangepicker-presets | Class name of the container of the presets |
| p-daterangepicker-preset-list | Class name of the list of the presets |
| p-daterangepicker-preset | Class name of a preset |
| p-daterangepicker-calendars | Class name of the container of the calendars |
| p-daterangepicker-datepicker | Class name of the DatePicker of the calendars |
| p-daterangepicker-footer | Class name of the footer of the panel |

### Design Tokens

| Token | CSS Variable | Description |
|-------|--------------|-------------|
| daterangepicker.transition.duration | --p-daterangepicker-transition-duration | Transition duration of root |
| daterangepicker.dropdown.width | --p-daterangepicker-dropdown-width | Width of dropdown |
| daterangepicker.dropdown.sm.width | --p-daterangepicker-dropdown-sm-width | Sm width of dropdown |
| daterangepicker.dropdown.lg.width | --p-daterangepicker-dropdown-lg-width | Lg width of dropdown |
| daterangepicker.dropdown.border.color | --p-daterangepicker-dropdown-border-color | Border color of dropdown |
| daterangepicker.dropdown.hover.border.color | --p-daterangepicker-dropdown-hover-border-color | Hover border color of dropdown |
| daterangepicker.dropdown.active.border.color | --p-daterangepicker-dropdown-active-border-color | Active border color of dropdown |
| daterangepicker.dropdown.border.radius | --p-daterangepicker-dropdown-border-radius | Border radius of dropdown |
| daterangepicker.dropdown.focus.ring.width | --p-daterangepicker-dropdown-focus-ring-width | Focus ring width of dropdown |
| daterangepicker.dropdown.focus.ring.style | --p-daterangepicker-dropdown-focus-ring-style | Focus ring style of dropdown |
| daterangepicker.dropdown.focus.ring.color | --p-daterangepicker-dropdown-focus-ring-color | Focus ring color of dropdown |
| daterangepicker.dropdown.focus.ring.offset | --p-daterangepicker-dropdown-focus-ring-offset | Focus ring offset of dropdown |
| daterangepicker.dropdown.focus.ring.shadow | --p-daterangepicker-dropdown-focus-ring-shadow | Focus ring shadow of dropdown |
| daterangepicker.dropdown.background | --p-daterangepicker-dropdown-background | Background of dropdown |
| daterangepicker.dropdown.hover.background | --p-daterangepicker-dropdown-hover-background | Hover background of dropdown |
| daterangepicker.dropdown.active.background | --p-daterangepicker-dropdown-active-background | Active background of dropdown |
| daterangepicker.dropdown.color | --p-daterangepicker-dropdown-color | Color of dropdown |
| daterangepicker.dropdown.hover.color | --p-daterangepicker-dropdown-hover-color | Hover color of dropdown |
| daterangepicker.dropdown.active.color | --p-daterangepicker-dropdown-active-color | Active color of dropdown |
| daterangepicker.clear.button.color | --p-daterangepicker-clear-button-color | Color of clear button |
| daterangepicker.clear.button.hover.color | --p-daterangepicker-clear-button-hover-color | Hover color of clear button |
| daterangepicker.clear.button.border.radius | --p-daterangepicker-clear-button-border-radius | Border radius of clear button |
| daterangepicker.panel.background | --p-daterangepicker-panel-background | Background of panel |
| daterangepicker.panel.border.color | --p-daterangepicker-panel-border-color | Border color of panel |
| daterangepicker.panel.color | --p-daterangepicker-panel-color | Color of panel |
| daterangepicker.panel.border.radius | --p-daterangepicker-panel-border-radius | Border radius of panel |
| daterangepicker.panel.shadow | --p-daterangepicker-panel-shadow | Shadow of panel |
| daterangepicker.panel.padding | --p-daterangepicker-panel-padding | Padding of panel |
| daterangepicker.panel.gap | --p-daterangepicker-panel-gap | Gap between the presets and the calendars |
| daterangepicker.presets.min.width | --p-daterangepicker-presets-min-width | Min width of presets |
| daterangepicker.presets.padding | --p-daterangepicker-presets-padding | Padding of presets |
| daterangepicker.presets.gap | --p-daterangepicker-presets-gap | Gap of presets |
| daterangepicker.presets.border.color | --p-daterangepicker-presets-border-color | Border color between the presets and the calendars |
| daterangepicker.preset.padding | --p-daterangepicker-preset-padding | Padding of preset |
| daterangepicker.preset.border.radius | --p-daterangepicker-preset-border-radius | Border radius of preset |
| daterangepicker.preset.color | --p-daterangepicker-preset-color | Color of preset |
| daterangepicker.preset.focus.background | --p-daterangepicker-preset-focus-background | Focus background of preset |
| daterangepicker.preset.focus.color | --p-daterangepicker-preset-focus-color | Focus color of preset |
| daterangepicker.preset.selected.background | --p-daterangepicker-preset-selected-background | Selected background of preset |
| daterangepicker.preset.selected.color | --p-daterangepicker-preset-selected-color | Selected color of preset |
| daterangepicker.preset.selected.focus.background | --p-daterangepicker-preset-selected-focus-background | Selected focus background of preset |
| daterangepicker.preset.selected.focus.color | --p-daterangepicker-preset-selected-focus-color | Selected focus color of preset |
| daterangepicker.preset.focus.ring.width | --p-daterangepicker-preset-focus-ring-width | Focus ring width of preset |
| daterangepicker.preset.focus.ring.style | --p-daterangepicker-preset-focus-ring-style | Focus ring style of preset |
| daterangepicker.preset.focus.ring.color | --p-daterangepicker-preset-focus-ring-color | Focus ring color of preset |
| daterangepicker.preset.focus.ring.offset | --p-daterangepicker-preset-focus-ring-offset | Focus ring offset of preset |
| daterangepicker.preset.focus.ring.shadow | --p-daterangepicker-preset-focus-ring-shadow | Focus ring shadow of preset |

