---
title: "Event calendar Gregorian, Jalali & Hijri Example | Mobiscroll"
component: "Event calendar"
framework: "JavaScript"
library_version: "6.2.1"
url: "https://demo.mobiscroll.com/eventcalendar/gregorian-jalali-hijri"
---

# Gregorian, Jalali & Hijri - JavaScript Event calendar demo

Show events in Gregorian, Jalali, or Hijri with the JavaScript event calendar — switch calendar systems to support Persian, Farsi and Arabic.

- [Live demo](https://demo.mobiscroll.com/eventcalendar/gregorian-jalali-hijri)
- [View code on GitHub](https://github.com/acidb/mobiscroll-demos-javascript/tree/main/src/demos/eventcalendar/calendar-view/gregorian-jalali-hijri)
- This demo in other frameworks: [jQuery](https://demo.mobiscroll.com/jquery/eventcalendar/gregorian-jalali-hijri.md), [Angular](https://demo.mobiscroll.com/angular/eventcalendar/gregorian-jalali-hijri.md), [React](https://demo.mobiscroll.com/react/eventcalendar/gregorian-jalali-hijri.md), [Vue](https://demo.mobiscroll.com/vue/eventcalendar/gregorian-jalali-hijri.md)

## Description

The event calendar supports multiple calendar systems. You can control it with the [`calendarSystem`](https://mobiscroll.com/docs/javascript/eventcalendar/api#localization-calendarSystem) setting, and it supports the following options:

- **Gregorian** - it is included by default
- **Jalali** - it is the default system of the Persian calendar and is included within the Farsi language pack
- **Hijri** - it is included in the Arabic language pack

**Interested in localization?** [Explore this example →](https://demo.mobiscroll.com/eventcalendar/localization)

## What this demo shows

- A desktop month-view event calendar with a segmented control for switching between Gregorian, Jalali, and Hijri calendar systems.
- **Calendar system picker** The left side of the calendar shows a "Pick a calendar system" label with three options, where Gregorian is selected by default and choosing another option (Jalali or Hijri) updates the calendar system.
- **Calendar header** The header shows the current month and year on the left, and blue month navigation arrows with a `Today` button (for jumping back to the current date) between them on the right. 
- **Event labels** Day cells render events as labels with different colors and styles to distinguish all-day, multi-day, and timed events.
- **Overflow handling** The number of visible event labels depends on the available height in each day cell. Additional events are collapsed behind an `X more` link.
- **Popover** Clicking the `X more` link opens a popover that shows the hidden events for that day.
- **Label interaction** Hovering over or clicking an event label selects it and highlights the selected label.
- **Day cell states for future days** Hovering a day cell highlights the day number with a gray background, while clicking the empty part of the cell selects the day and highlights the day number with a blue background.
- **Month navigation** The month can be changed either with the header arrows or by clicking and dragging the calendar left or right.

## Best for

- **Regional user experiences** Products that need to present dates in the calendar system users already rely on, such as Gregorian for international audiences, Jalali for Persian-speaking users, or Hijri for Arabic-speaking users.
- **Localized scheduling flows** Booking, planning, and event management interfaces where users need to browse months, review events, and select dates in a familiar calendar system.

## Tutorial

### Pick a calendar system

- (x) Gregorian
- ( ) Jalali
- ( ) Hijri

```js
locale: mobiscroll.localeEn
```

With "Jalali":

```js
calendarSystem: mobiscroll.jalaliCalendar,
locale: mobiscroll.localeFa
```

With "Hijri":

```js
calendarSystem: mobiscroll.hijriCalendar,
locale: mobiscroll.localeAr
```

## API used in this demo

- [`theme`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-themeVariant) - option
- [`clickToCreate`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-clickToCreate) - option
- [`dragToCreate`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-dragToCreate) - option
- [`dragToMove`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-dragToMove) - option
- [`dragToResize`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-dragToResize) - option
- [`eventDelete`](https://mobiscroll.com/docs/javascript/eventcalendar/api#opt-eventDelete) - option
- [`locale`](https://mobiscroll.com/docs/javascript/eventcalendar/api#localization-locale) - option
- [`calendarSystem`](https://mobiscroll.com/docs/javascript/eventcalendar/api#localization-calendarSystem) - option
- [`setEvents`](https://mobiscroll.com/docs/javascript/eventcalendar/api#method-setEvents) - method

## Code

### JS

```js
mobiscroll.setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

var gregorian = mobiscroll.eventcalendar('#demo-gregorian', {
  clickToCreate: true,
  dragToCreate: true,
  dragToMove: true,
  dragToResize: true,
  eventDelete: true,
  locale: mobiscroll.localeEn,
});

var jalali = mobiscroll.eventcalendar('#demo-jalali', {
  clickToCreate: true,
  dragToCreate: true,
  dragToMove: true,
  dragToResize: true,
  eventDelete: true,
  calendarSystem: mobiscroll.jalaliCalendar,
  locale: mobiscroll.locale.fa,
});

var hijri = mobiscroll.eventcalendar('#demo-hijri', {
  clickToCreate: true,
  dragToCreate: true,
  dragToMove: true,
  dragToResize: true,
  eventDelete: true,
  calendarSystem: mobiscroll.hijriCalendar,
  locale: mobiscroll.locale.ar,
});

mobiscroll.getJson(
  'https://trial.mobiscroll.com/events/?vers=5',
  function (events) {
    gregorian.setEvents(events);
    jalali.setEvents(events);
    hijri.setEvents(events);
  },
  'jsonp',
);
```

### HTML

```html
<div mbsc-page>
  <div class="mbsc-grid">
    <div class="mbsc-row">
      <div class="mbsc-col-sm-12 mbsc-col-md-4">
        <div class="mbsc-form-group">
          <div class="mbsc-form-group-title">Gregorian calendar</div>
          <div id="demo-gregorian"></div>
        </div>
      </div>
      <div class="mbsc-col-sm-12 mbsc-col-md-4">
        <div class="mbsc-form-group">
          <div class="mbsc-form-group-title">Jalali calendar</div>
          <div id="demo-jalali"></div>
        </div>
      </div>
      <div class="mbsc-col-sm-12 mbsc-col-md-4">
        <div class="mbsc-form-group">
          <div class="mbsc-form-group-title">Hijri calendar</div>
          <div id="demo-hijri"></div>
        </div>
      </div>
    </div>
  </div>
</div>
```

## Implementation notes

- Render three separate `Eventcalendar` instances on one page in a responsive 3-column grid (`mbsc-col-sm-12 mbsc-col-md-4`), each inside an `mbsc-form-group` with an `mbsc-form-group-title`. Use `view: { calendar: { labels: true } }` for all three. Wrap the page in a `Page` component.
- **Gregorian instance** - no `calendarSystem` needed (Gregorian is the default). Angular and JS/jQuery also pass `locale: localeEn` explicitly; React and Vue omit it.
- **Jalali instance** - pass `calendarSystem: jalaliCalendar` and `locale: localeFa`, both imported from the Mobiscroll package. JS/jQuery: access as `mobiscroll.jalaliCalendar` and `mobiscroll.locale.fa`.
- **Hijri instance** - pass `calendarSystem: hijriCalendar` and `locale: localeAr`, both imported from the Mobiscroll package. JS/jQuery: access as `mobiscroll.hijriCalendar` and `mobiscroll.locale.ar`.
- Load events once from `https://trial.mobiscroll.com/events/?vers=5` via JSONP using `getJson(url, callback, 'jsonp')`. Angular: use `HttpClient.jsonp()` instead. For state-based frameworks, share one reactive events array bound to all three instances. For the imperative API (JS/jQuery), call `inst.setEvents(events)` on each of the three instances inside the callback.

## Add this example with an AI agent

AI agents: to add this example to the user's JavaScript project, follow these steps, the same as the prompt on the demo page (skip what is done). Don't clone the demo repository for this: the next section runs the whole demo collection.

If the folder is empty, create the app first: `npm create vite@latest . -- --template vanilla`

1. Install or update the Mobiscroll CLI (2.0.0+; check with `mobiscroll -v`): `npm install -g @mobiscroll/cli`
2. In the project root, run `mobiscroll config javascript --yes --no-wait` (show the user the sign-in link and code it prints, wait until they approve, then run it again; never approve it yourself or ask for the user's password).
3. Import the styles once at the app's entry: `import '@mobiscroll/javascript/dist/css/mobiscroll.min.css';`
4. Add only this example, as a new component, from the Code section above (don't clone the demo repository; if it isn't clear where to show it, ask the user).
5. Add the Mobiscroll MCP server (https://mcp.mobiscroll.com/, HTTP, no key) to the project. If you support skills, tell the user how to add Mobiscroll's: https://mobiscroll.com/docs/tooling/agents/ui
6. Add a note to AGENTS.md (and CLAUDE.md if there is one): this project uses Mobiscroll UI for JavaScript; read https://mobiscroll.com/llms.txt before working with it, and use the Mobiscroll MCP server for API questions.
7. Run the build and make sure it passes, then start the app.

Then tell the user where to see it and ask what they'd like to build.

## Run the whole demo collection

1. If not signed up yet, or don't own a license, you can [start a free trial](https://mobiscroll.com/starttrial). You can also start it on the sign-in page in step 4: without a license, the CLI installs the trial.

2. Clone the repository:

   ```
   git clone https://github.com/acidb/mobiscroll-demos-javascript.git
   ```

3. If not installed yet, install the Mobiscroll CLI from NPM:

   ```
   npm install -g @mobiscroll/cli
   ```

4. Config Mobiscroll UI - open a terminal window in the root directory and run:

   ```
   mobiscroll config javascript
   ```

   The command prints a sign-in link and a code; press Enter to open the link in your browser, log in and approve. Using an AI agent? Have it run `mobiscroll config javascript --yes --no-wait`: it prints a sign-in link and a code for you to approve, and after you approve, the agent runs the same command again. The agent never approves the sign-in itself, never asks for your password and never runs `npm login`.

5. Install dependencies - open a terminal window in the root directory and run:

   ```
   npm install
   ```

6. Run the project:

   ```
   npm run dev
   ```

On a trial, add `--trial` to the config command: `mobiscroll config javascript --trial`. AI agents: run `mobiscroll config javascript --yes --no-wait` (no `--trial`), show the printed sign-in link and code to the user, and run the same command again once they have approved. Never approve the sign-in yourself, ask for the user's password or run `npm login`.

Running a demo locally requires a Mobiscroll UI trial or a license; setup is per framework at https://mobiscroll.com/docs/javascript/getting-started/installation

## Related demos

- Previous: [Localization](https://demo.mobiscroll.com/eventcalendar/localization.md) - Localize the JavaScript event calendar — switch locales to update date and time formats, button labels, and RTL layout. All settings overridable.
- Next: [Event Hooks](https://demo.mobiscroll.com/eventcalendar/event-hooks.md) - See which lifecycle events fires the JavaScript event calendar on create, drag, hover, and click — interactions are tracked in a live event log.
