Support for allowEdit has been provided from v16.2.46.
Specifies whether the input textbox is editable or not. Here the user can select the value from the
popup and cannot edit in the input textbox.
Defaults to true
cssClassstring
Sets the root CSS class to the DateRangePicker which allows you to customize the appearance.
Sets the maximum level of view (month, year, decade) in the Calendar.
Depth view should be smaller than the start view to restrict its view navigation.
Defaults to Month
enablePersistenceboolean
Enable or disable the persisting component’s state between the page reloads. If enabled, following list of states will be persisted.
startDate
endDate
value
Defaults to false
enableRtlboolean
Enable or disable rendering component in right to left direction.
Defaults to false
enabledboolean
Specifies the component to be disabled which prevents the DateRangePicker from user interactions.
Defaults to true
endDateDate
Gets or sets the end date of the date range selection.
Defaults to null
firstDayOfWeeknumber
Gets or sets the Calendar’s first day of the week. By default, the first day of the week will be based on the current culture.
For more details about firstDayOfWeek refer to First day of week documentation.
Defaults to null
floatLabelTypeFloatLabelType|string
Specifies the placeholder text to be floated.
Possible values are:
Never: The label will never float in the input when the placeholder is available.
Always: The floating label will always float above the input.
Auto: The floating label will float above the input after focusing or entering a value in the input.
Defaults to Syncfusion.EJ2.Inputs.FloatLabelType.Never
Specifies the component popup display full screen in mobile devices.
Defaults to false
htmlAttributes { : }
You can add the additional html attributes such as disabled, value etc., to the element.
If you configured both property and equivalent html attribute then the component considers the property value.
<inputid="daterangepicker"type="text">
import{DateRangePicker}from'@syncfusion/ej2-calendars';letdaterangepicker: DateRangePicker=newDateRangePicker({htmlAttributes:{name:"range",placeholder:"Choose a range"}});daterangepicker.appendTo('#daterangepicker');
Specifies an array of acceptable date input formats for parsing user input.
Defaults to null
keyConfigs { : }
Customizes the key actions in DateRangePicker.
For example, when using German keyboard, the key actions can be customized using these shortcuts.
Input Navigation
Key action
Key
altUpArrow
alt+uparrow
altDownArrow
alt+downarrow
escape
escape
Calendar Navigation (Use the following list of keys to navigate the currently focused Calendar after the popup has opened).
Key action
Key
controlUp
ctrl+38
controlDown
ctrl+40
moveDown
downarrow
pageUp
pageup
</tr>
pageDown
pagedown
shiftPageUp
shift+pageup
shiftPageDown
shift+pagedown
moveUp
uparrow
moveLeft
leftarrow
moveRight
rightarrow
select
enter
home
home
end
end
controlHome
ctrl+home
controlEnd
ctrl+end
altUpArrow
alt+uparrow
spacebar
space
enter
enter
altRightArrow
alt+rightarrow
altLeftArrow
alt+leftarrow
</table>
```html
```
```ts
import { DateRangePicker } from '@syncfusion/ej2-calendars';
let daterangepicker: DateRangePicker = new DateRangePicker({
keyConfigs: {
select: "space",
home: "ctrl+home",
end: "ctrl+end"
}
});
daterangepicker.appendTo('#daterangepicker');
```
Defaults to *null*
localestring
Overrides the global culture and localization value for this component. Default global culture is 'en-US'.
Defaults to *'en-US'*
maxDate
Gets or sets the maximum date that can be selected in the calendar-popup.
Defaults to *new Date(2099, 11, 31)*
maxDaysnumber
Specifies the maximum span of days that can be allowed in a date range selection.
> For more details refer to
[`Range Span`](../../daterangepicker/range-restriction/#range-span) documentation.
Defaults to *null*
minDate
Gets or sets the minimum date that can be selected in the calendar-popup.
Defaults to *new Date(1900, 00, 01)*
minDaysnumber
Specifies the minimum span of days that can be allowed in date range selection.
> For more details refer to
[`Range Span`](../../daterangepicker/range-restriction/#range-span) documentation.
Defaults to *null*
openOnFocusboolean
By default, the popup opens while clicking on the daterangepicker icon.
If you want to open the popup while focusing the daterange input then specify its value as true.
Defaults to *false*
placeholderstring
Specifies the placeholder text that need to be displayed in the DateRangePicker component.
Defaults to *null*
Set the predefined ranges which let the user pick required range easily in a component.
> For more details refer to
[`Preset Ranges`](../../daterangepicker/customization#preset-ranges) documentation.
```html
```
```ts
import { DateRangePicker } from '@syncfusion/ej2-calendars';
let daterangepicker: DateRangePicker = new DateRangePicker({
presets: [
{ label: 'Today', start: new Date(), end: new Date() },
{ label: 'This Month', start: new Date(new Date().setDate(1)), end: new Date() }
]
});
daterangepicker.appendTo('#daterangepicker');
```
Defaults to *null*
readonlyboolean
Denies the editing the ranges in the DateRangePicker component.
Defaults to *false*
separatorstring
Sets or gets the string that used between the start and end date string.
Defaults to *'-'*
serverTimezoneOffsetnumber
By default, the date value will be processed based on system time zone.
If you want to process the initial date value using server time zone
then specify the time zone value to `serverTimezoneOffset` property.
Defaults to *null*
showClearButtonboolean
Specifies whether to show or hide the clear icon
Defaults to *true*
Specifies the initial view of the Calendar when it is opened.
With the help of this property, initial view can be changed to year or decade view.
Defaults to *Month*
startDateDate
Gets or sets the start date of the date range selection.
Defaults to *null*
strictModeboolean
Specifies the component to act as strict which allows entering only a valid date range in a DateRangePicker.
> For more details refer to
[`Strict Mode`](../../daterangepicker/range-restriction#strict-mode)documentation.
Defaults to *false*
Gets or sets the start and end date of the Calendar.
```html
```
```ts
import { DateRangePicker } from '@syncfusion/ej2-calendars';
let daterangepicker: DateRangePicker = new DateRangePicker({
value:[new Date(), new Date("12/12/2019")]
});
daterangepicker.appendTo('#daterangepicker');
```
Defaults to *null*
weekNumberboolean
Determines whether the week number of the Calendar is to be displayed or not.
The week number is displayed in every week row.
> For more details about weekNumber refer to
[`Calendar with week number`](../../calendar/how-to/render-the-calendar-with-week-numbers)documentation.
Defaults to *false*
Specifies the rule for defining the first week of the year.
Defaults to *FirstDay*
widthnumber|string
Specifies the width of the DateRangePicker component.
Defaults to *''*
zIndexnumber
specifies the z-index value of the dateRangePicker popup element.
Defaults to *1000*
## Methods
### addEventListener
Adds the handler to the given event listener.
| Parameter | Type | Description |
|------|------|-------------|
| eventName | `string` | A String that specifies the name of the event |
| handler | `Function` | Specifies the call to run when the event occurs. |
Returns *void*
### appendTo
Appends the control within the given HTML element
| Parameter | Type | Description |
|------|------|-------------|
| selector (*optional*) | `string` | `HTMLElement` | Target element where control needs to be appended |
Returns *void*
### attachUnloadEvent
Adding unload event to persist data when enable persistence true
Returns *void*
### dataBind
When invoked, applies the pending property changes immediately to the component.
Returns *void*
### destroy
To destroy the widget.
Returns *void*
### detachUnloadEvent
Removing unload event to persist data when enable persistence true
Returns *void*
### focusIn
Sets the focus to widget for interaction.
Returns *void*
### focusOut
Remove the focus from widget, if the widget is in focus state.
Returns *void*
### getLocalData
Returns the persistence data for component
Returns *any*
### getPersistData
Return the properties that are maintained upon browser refresh.
Returns *string*
### getRootElement
Returns the route element of the component
Returns *HTMLElement*
### getSelectedRange
Return the selected range and day span in the DateRangePicker.
Returns *Object*
### handleUnload
Handling unload event to persist data when enable persistence true
Returns *void*
### hide
To close the Popup container in the DateRangePicker component.
Returns *void*
### refresh
Applies all the pending property changes and render the component again.
Returns *void*
### removeEventListener
Removes the handler from the given event listener.
| Parameter | Type | Description |
|------|------|-------------|
| eventName | `string` | A String that specifies the name of the event to remove |
| handler | `Function` | Specifies the function to remove |
Returns *void*
### show
To open the Popup container in the DateRangePicker component.
Returns *void*
### Inject
Dynamically injects the required modules to the component.
| Parameter | Type | Description |
|------|------|-------------|
| moduleList | `Function[]` | ? |
Returns *void*
## Events