Articles in this section
Category / Section

How to render Daterangepicker with single calendar

1 min read

By default, the EJ2 DateRangePicker component will be rendered with two calendars in the desktop mode and with one calendar in the mobile mode based on the available spaces. The following section explains how to render the DateRangePicker component with one calendar in the desktop mode.

DateRangePicker in desktop mode (with two calendars)

DateRangePicker in mobile mode (with one calendar)

You can render the DateRangePicker with one calendar by overriding the default rendering to mobile mode by enabling the “isMobile” option as true in the created event of the DateRangePicker component as mentioned in the following code example.

[index.html]

<div id="wrapper">
        <input id="daterangepicker" type="text">
</div>

 

 

[index.ts]

import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
import { DateRangePicker } from '@syncfusion/ej2-calendars';
 
let daterangepicker: DateRangePicker = new DateRangePicker({
    created: onCreate
});
daterangepicker.appendTo('#daterangepicker');
 
function onCreate(args) {
     (daterangepicker as any).isMobile = true;
}

 

The sample has been created using the previous code and attached below.

https://stackblitz.com/edit/rybata-vdtfom?file=index.ts

For more information about DateRangePicker functionalities, refer to the UG Documentation, API Reference, and Samples section.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied