Calendar Mode in Angular Scheduler

The Scheduler supports two calendar modes:

  • Gregorian Calendar
  • Islamic Calendar

Gregorian Calendar

By default, the Scheduler uses the Gregorian calendar, the most widely adopted solar calendar globally. The Gregorian calendar consists of 12 months, each with 28 to 31 days. Leap years, which are divisible by four, have 366 days; non-leap years contain 365 days.

Islamic Calendar

The Islamic calendar, also known as the Hijri or Muslim calendar, is a lunar calendar with 12 months in a year and 354 or 355 days. Each month denotes the start of a new lunar cycle, and each month can have 29 or 30 days depending on moon visibility. Odd-numbered months have 30 days, and even-numbered months have 29 days.

The current Islamic year is 1440 AH. Usually, the Gregorian calendar runs from approximately 11 September 2018 to 30 August 2019 for this 1440 AH year.

The Scheduler has a property calendarMode that is used to switch between the Gregorian and Islamic calendar modes. By default, it is set to Gregorian, and to use Islamic calendar dates, set the Scheduler calendarMode to Islamic. The following example shows how to display Islamic calendar dates on the Scheduler.

To use the Islamic calendar in the Scheduler, import the Calendar and Islamic modules from the ej2-calendars package and inject them using the Calendar.Inject method. Also, ensure the following CLDR data files are loaded via the loadCldr function, as this is necessary for multilingual and Islamic date support:

  • numberingSystems.json
  • ca-gregorian.json
  • numbers.json
  • timeZoneNames.json
  • ca-islamic.json

For complete instructions on installing and loading CLDR data, refer to the Internationalization guide.

import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ScheduleModule } from '@syncfusion/ej2-angular-schedule'



import { Component } from '@angular/core';
import { loadCldr, L10n } from '@syncfusion/ej2-base';
import { Calendar, Islamic } from '@syncfusion/ej2-angular-calendars';
import {
  ScheduleComponent, DayService, WeekService, MonthService, MonthAgendaService,
  AgendaService, TimelineViewsService, TimelineMonthService, EventSettingsModel, WorkWeekService
} from '@syncfusion/ej2-angular-schedule';
import { scheduleData } from './datasource';
import * as localeObj from './locale.json';
import arNumberData from '@syncfusion/ej2-cldr-data/main/ar/numbers.json';
import artimeZoneData from '@syncfusion/ej2-cldr-data/main/ar/timeZoneNames.json';
import arGregorian from '@syncfusion/ej2-cldr-data/main/ar/ca-gregorian.json';
import arIslamic from '@syncfusion/ej2-cldr-data/main/ar/ca-islamic.json';
import arNumberingSystem from '@syncfusion/ej2-cldr-data/supplemental/numberingSystems.json';

Calendar.Inject(Islamic);

L10n.load(localeObj);
loadCldr(arNumberData, artimeZoneData, arGregorian, arIslamic, arNumberingSystem);

@Component({
imports: [
        
        ScheduleModule
    ],
standalone: true,
  selector: 'app-root',
  providers: [DayService, WeekService, MonthService, AgendaService, MonthAgendaService, TimelineViewsService, TimelineMonthService],
  // specifies the template string for the Schedule component
  template: `<ejs-schedule width='100%' height='550px' calendarMode='Islamic' locale='ar' [enableRtl]="enableRtl" showQuickInfo="false" [selectedDate]="selectedDate" [eventSettings]="eventSettings">
    <e-views>
    <e-view option='Day'></e-view>
      <e-view option='TimelineDay'></e-view>
      <e-view option='Week'></e-view>
      <e-view option='TimelineWeek'></e-view>
      <e-view option='Month'></e-view>
      <e-view option='TimelineMonth'></e-view>
      <e-view option='Agenda'></e-view>
      <e-view option='MonthAgenda'></e-view>
    </e-views>
  </ejs-schedule>`
})
export class AppComponent {
    public enableRtl: Boolean = true;
    public selectedDate: Date = new Date(2018, 1, 15);
    public eventSettings: EventSettingsModel = { dataSource: scheduleData };
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));

You can refer to our Angular Scheduler feature tour page for its feature overview. You can also explore our Angular Scheduler example to learn how to present and manipulate data.