Islamic calendar in EJ2 JavaScript Calendar control

26 Apr 20235 minutes to read

In addition to the Gregorian calendar, the calendar control supports displaying the Islamic calendar (Hijri calendar). Islamic calendar or Hijri calendar is a lunar calendar consisting of 12 months in a year of 354 or 355 days. To know more about Islamic calendar, please refer this wikipedia.

Also, it consists of all Gregorian calendar functionalities as like min and max date, week number, start day of the week, multi selection, enable RTL, start and depth view, localization, highlight and customize the specific dates.

By default, calendar mode is in Gregorian. You can enable the Islamic mode by setting the calendarMode as Islamic. Also, need to import and injecting the Islamic module from ej2-calendars as shown below.

import { Islamic, Calendar } from ‘@syncfusion/ej2-calendars’;\

The following example demonstrates how to display the Islamic Calendar (Hijri Calendar).

    var span;
    var addClass = ej.base.addClass;
    var calendar = new ej.calendars.Calendar({
         calendarMode: 'Islamic',
         renderDayCell: disableDate

    function disableDate(args) {
        /*Date need to be disabled*/
        if ( === 2 || === 10 || === 28) {
            args.isDisabled = true;
        if ( === 13) {
            span = document.createElement('span');
            args.element.children[0].className += 'e-day sf-icon-cup highlight';
            addClass([args.element], ['special', 'e-day', 'dinner']);
            args.element.setAttribute('data-val', ' Dinner !');
        if ( === 23) {
            args.element.children[0].className += 'e-day sf-icon-start highlight';
            span = document.createElement('span');
            span.setAttribute('class', 'sf-icons-star highlight');
            //use the imported method to add the multiple classes to the given element
            addClass([args.element], ['special', 'e-day', 'holiday']);
            args.element.setAttribute('data-val', ' Holiday !');
<!DOCTYPE html><html lang="en"><head>
    <title>Essential JS 2 Calendar control</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Typescript UI Controls">
    <meta name="author" content="Syncfusion">
    <!--style reference from the Calendar component-->
    <link href="" rel="stylesheet">
    <link href="" rel="stylesheet">
    <link href="" rel="stylesheet">
    <!--style reference from app-->
    <link href="styles.css" rel="stylesheet">
<script src="" type="text/javascript"></script>
<script src="" type ="text/javascript"></script>

    <div id="container">
        <!--element which is going to render the Calendar-->
        <div id="element"></div>

var ele = document.getElementById('container');
if(ele) { = "visible";
<script src="index.js" type="text/javascript"></script>