Search results

DateRangePickerComponent

Represents the Essential JS 2 Angular DateRangePicker Component.

<ejs-daterangepicker [startDate]='date' [endDate]='date'></ejs-daterangepicker>

Properties

allowEdit

boolean

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

cssClass

string

Sets the root CSS class to the DateRangePicker which allows you to customize the appearance.

Defaults to

dayHeaderFormat

string

Specifies the format of the day that to be displayed in header. By default, the format is ‘short’. Possible formats are:

  • Short - Sets the short format of day name (like Su ) in day header.
  • Narrow - Sets the single character of day name (like S ) in day header.
  • Abbreviated - Sets the min format of day name (like Sun ) in day header.
  • Wide - Sets the long format of day name (like Sunday ) in day header.

Defaults to Short

depth

string

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

enablePersistence

boolean

Enable or disable the persisting component’s state between the page reloads. If enabled, following list of states will be persisted.

  1. startDate
  2. endDate
  3. value

Defaults to false

enableRtl

boolean

Enable or disable rendering component in right to left direction.

Defaults to false

enabled

boolean

Specifies the component to be disabled which prevents the DateRangePicker from user interactions.

Defaults to true

endDate

Date

Gets or sets the end date of the date range selection.

Defaults to null

firstDayOfWeek

number

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

floatLabelType

FloatLabelType | 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

format

string | RangeFormatObject

Sets or gets the required date format to the start and end date string.

For more details refer to Formatsample.

Defaults to null

htmlAttributes

Object

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.

<ejs-daterangepicker [htmlAttributes]="htmlAttributes"></ejs-daterangepicker>
import { Component, ViewEncapsulation } from '@angular/core';

@Component({
  selector: 'app-root',
  styleUrls: ['app.component.css'],
  templateUrl: 'app.component.html',
  encapsulation: ViewEncapsulation.None
})

export class AppComponent {
  constructor() { }
  public htmlAttributes = { name: "range", placeholder:"Choose a range" };
}

Defaults to {}

keyConfigs

Object

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
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
<ejs-daterangepicker [keyConfigs]="keyConfigs"></ejs-daterangepicker>
import { Component, ViewEncapsulation } from '@angular/core';

@Component({
  selector: 'app-root',
  styleUrls: ['app.component.css'],
  templateUrl: 'app.component.html',
  encapsulation: ViewEncapsulation.None
})

export class AppComponent {
  constructor() { }
  public keyConfigs ={
    select: "space",
    home: "ctrl+home",
    end: "ctrl+end"
  };
}

Defaults to null

locale

string

Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.

Defaults to ‘en-US’

max

Date

Gets or sets the maximum date that can be selected in the calendar-popup.

Defaults to new Date(2099, 11, 31)

maxDays

number

Specifies the maximum span of days that can be allowed in a date range selection.

For more details refer to Range Span documentation.

Defaults to null

min

Date

Gets or sets the minimum date that can be selected in the calendar-popup.

Defaults to new Date(1900, 00, 01)

minDays

number

Specifies the minimum span of days that can be allowed in date range selection.

For more details refer to Range Span documentation.

Defaults to null

openOnFocus

boolean

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

placeholder

string

Specifies the placeholder text that need to be displayed in the DateRangePicker component.

Defaults to null

presets

PresetsModel[]

Set the predefined ranges which let the user pick required range easily in a component.

For more details refer to Preset Ranges documentation.

<ejs-daterangepicker [presets]="presets"></ejs-daterangepicker>
import { Component, ViewEncapsulation } from '@angular/core';

@Component({
  selector: 'app-root',
  styleUrls: ['app.component.css'],
  templateUrl: 'app.component.html',
  encapsulation: ViewEncapsulation.None
})

export class AppComponent {
  constructor() { }
  public presets = [
    { label: 'Today', start: new Date(), end: new Date() },
    { label: 'This Month', start: new Date(new Date().setDate(1)), end: new Date() }
  ];
}

Defaults to null

readonly

boolean

Denies the editing the ranges in the DateRangePicker component.

Defaults to false

separator

string

Sets or gets the string that used between the start and end date string.

Defaults to ’-’

serverTimezoneOffset

number

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

showClearButton

boolean

Specifies whether to show or hide the clear icon

Defaults to true

start

any

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

startDate

Date

Gets or sets the start date of the date range selection.

Defaults to null

strictMode

boolean

Specifies the component to act as strict which allows entering only a valid date range in a DateRangePicker.

For more details refer to Strict Modedocumentation.

Defaults to false

value

Date[] | DateRange

Gets or sets the start and end date of the Calendar.

Defaults to *null`html <ejs-daterangepicker [value]=“value”>

```ts
import { Component, ViewEncapsulation } from '@angular/core';

@Component({
  selector: 'app-root',
  styleUrls: ['app.component.css'],
  templateUrl: 'app.component.html',
  encapsulation: ViewEncapsulation.None
})

export class AppComponent {
  constructor() { }
  public value = [new Date(), new Date("12/12/2019")];
}
```*

<h3 class="doc-prop-wrapper" id="weeknumber" data-Path="weeknumber-weekNumber">
<a href="#weeknumber" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>weekNumber</span>

<span class="doc-prop-type"> `boolean`
</span>

</h3>


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/week-number#render-the-calendar-with-week-numbers)documentation.

Defaults to *false*

<h3 class="doc-prop-wrapper" id="width" data-Path="width-width">
<a href="#width" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>width</span>

<span class="doc-prop-type"> `number` &#124;  `string`
</span>

</h3>


Specifies the width of the DateRangePicker component.

Defaults to *''*

<h3 class="doc-prop-wrapper" id="zindex" data-Path="zindex-zIndex">
<a href="#zindex" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>zIndex</span>

<span class="doc-prop-type"> `number`
</span>

</h3>


specifies the z-index value of the dateRangePicker popup element.

Defaults to *1000*

## Methods

### destroy

To destroy the widget.

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*

### getPersistData

Return the properties that are maintained upon browser refresh.

Returns *string*

### getSelectedRange

Return the selected range and day span in the DateRangePicker.

Returns *Object*

### hide

To close the Popup container in the DateRangePicker component.

Returns *void*

### show

To open the Popup container in the DateRangePicker component.

Returns *void*

## Events

<h3 class="doc-prop-wrapper" id="blur" data-Path="blur-blur">
<a href="#blur" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>blur</span>

<span class="doc-prop-type">  `EmitType<BlurEventArgs>`
</span>

</h3>


Triggers when the control loses the focus.

<h3 class="doc-prop-wrapper" id="change" data-Path="change-change">
<a href="#change" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>change</span>

<span class="doc-prop-type"> [`EmitType<RangeEventArgs>`](./rangeEventArgs)
</span>

</h3>


Triggers when the Calendar value is changed.

<h3 class="doc-prop-wrapper" id="cleared" data-Path="cleared-cleared">
<a href="#cleared" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>cleared</span>

<span class="doc-prop-type">  `EmitType<ClearedEventArgs>`
</span>

</h3>


Triggers when daterangepicker value is cleared using clear button.

<h3 class="doc-prop-wrapper" id="close" data-Path="close-close">
<a href="#close" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>close</span>

<span class="doc-prop-type">  `EmitType<Object>`
</span>

</h3>


Triggers when the DateRangePicker is closed.

<h3 class="doc-prop-wrapper" id="created" data-Path="created-created">
<a href="#created" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>created</span>

<span class="doc-prop-type">  `EmitType<Object>`
</span>

</h3>


Triggers when Calendar is created.

<h3 class="doc-prop-wrapper" id="destroyed" data-Path="destroyed-destroyed">
<a href="#destroyed" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>destroyed</span>

<span class="doc-prop-type">  `EmitType<Object>`
</span>

</h3>


Triggers when Calendar is destroyed.

<h3 class="doc-prop-wrapper" id="focus" data-Path="focus-focus">
<a href="#focus" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>focus</span>

<span class="doc-prop-type">  `EmitType<FocusEventArgs>`
</span>

</h3>


 Triggers when the control gets focus.

<h3 class="doc-prop-wrapper" id="navigated" data-Path="navigated-navigated">
<a href="#navigated" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>navigated</span>

<span class="doc-prop-type">  `EmitType<NavigatedEventArgs>`
</span>

</h3>


Triggers when the Calendar is navigated to another view or within the same level of view.

<h3 class="doc-prop-wrapper" id="open" data-Path="open-open">
<a href="#open" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>open</span>

<span class="doc-prop-type">  `EmitType<Object>`
</span>

</h3>


Triggers when the DateRangePicker is opened.

<h3 class="doc-prop-wrapper" id="renderdaycell" data-Path="renderdaycell-renderDayCell">
<a href="#renderdaycell" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>renderDayCell</span>

<span class="doc-prop-type">  `EmitType<RenderDayCellEventArgs>`
</span>

</h3>


Triggers when each day cell of the Calendar is rendered.

<h3 class="doc-prop-wrapper" id="select" data-Path="select-select">
<a href="#select" aria-hidden="true" class="anchor">
<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16">
<path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 
3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 
4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 
1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z">
</path>
</svg>
</a><span class='doc-prop-name'>select</span>

<span class="doc-prop-type">  `EmitType<Object>`
</span>

</h3>


Triggers on selecting the start and end date.