---
title: "JQuery Timeline Gregorian, Jalali & Hijri Example | Mobiscroll"
component: "Timeline"
framework: "jQuery"
library_version: "6.1.5"
url: "https://demo.mobiscroll.com/jquery/timeline/gregorian-jalali-hijri"
---

# Gregorian, Jalali & Hijri - jQuery Timeline demo

Use the JQuery Timeline with Gregorian, Jalali, or Hijri calendar systems — switch by locale to build scheduling interfaces for Persian. For jQuery or jQuery Mobile.

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

## Description

The timeline supports multiple calendar systems. You can control it with the [`calendarSystem`](https://mobiscroll.com/docs/jquery/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/jquery/timeline/localization)

## What this demo shows

- A desktop daily timeline where hours are arranged horizontally and a hierarchical resource tree arranged vertically on the left.
- **Calendar system picker** The left side of the timeline 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.
- **Header navigation** The month and year label opens date navigation, while the previous and next arrows move between days and the Today button returns to the current date.
- **Day view** The strip below the header shows the selected days, with the current date highlighted. The timeline displays hourly columns from 12 AM to 12 PM.
- **Resources** Multiple resources are shown as separate timeline rows.
- **Current time** A vertical blue line with a time label marks the current time.
- **Hover behavior** Hovering over the time grid shows a time indicator that follows the cursor in 15-minute increments.
- **Event cards** Events are shown as colored cards with a left color stripe, a bold title, a description, and a bold time range.
- **Date positioning** Events are positioned by their assigned resource and exact date range.
- **Event interaction** Events highlight on hover and show drag and resize handles for repositioning or changing duration.
- **Event selection** Clicking an event selects and highlights it.
- **Event creation** New events can be created by double-clicking the timeline or by clicking and dragging across a time range.
- **Scrolling** The timeline supports horizontal and vertical scrolling for navigating through time and resources.

## 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/jquery/eventcalendar/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-themeVariant) - option
- [`clickToCreate`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-clickToCreate) - option
- [`dragToCreate`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-dragToCreate) - option
- [`dragToMove`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-dragToMove) - option
- [`dragToResize`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-dragToResize) - option
- [`eventDelete`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-eventDelete) - option
- [`locale`](https://mobiscroll.com/docs/jquery/eventcalendar/api#localization-locale) - option
- [`resources`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-resources) - option
- [`view`](https://mobiscroll.com/docs/jquery/eventcalendar/api#opt-view) - option
- [`calendarSystem`](https://mobiscroll.com/docs/jquery/eventcalendar/api#localization-calendarSystem) - option
- [`setEvents`](https://mobiscroll.com/docs/jquery/eventcalendar/api#method-setEvents) - method

## Code

### JS

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

$(function () {
  var myResources = [
    {
      id: 1,
      name: 'Ryan',
      color: '#fdf500',
    },
    {
      id: 2,
      name: 'Kate',
      color: '#ff4600',
    },
    {
      id: 3,
      name: 'John',
      color: '#ff0101',
    },
    {
      id: 4,
      name: 'Mark',
      color: '#239a21',
    },
    {
      id: 5,
      name: 'Sharon',
      color: '#8f1ed6',
    },
    {
      id: 6,
      name: 'Ashley',
      color: '#01adff',
    },
  ];
  var gregorian = $('#demo-gregorian')
    .mobiscroll()
    .eventcalendar({
      clickToCreate: true,
      dragToCreate: true,
      dragToMove: true,
      dragToResize: true,
      eventDelete: true,
      locale: mobiscroll.localeEn,
      resources: myResources,
      view: {
        timeline: { type: 'day' },
      },
    })
    .mobiscroll('getInst');

  var jalali = $('#demo-jalali')
    .mobiscroll()
    .eventcalendar({
      clickToCreate: true,
      dragToCreate: true,
      dragToMove: true,
      dragToResize: true,
      eventDelete: true,
      calendarSystem: mobiscroll.jalaliCalendar,
      locale: mobiscroll.locale.fa,
      resources: myResources,
      view: {
        timeline: { type: 'day' },
      },
    })
    .mobiscroll('getInst');

  var hijri = $('#demo-hijri')
    .mobiscroll()
    .eventcalendar({
      clickToCreate: true,
      dragToCreate: true,
      dragToMove: true,
      dragToResize: true,
      eventDelete: true,
      calendarSystem: mobiscroll.hijriCalendar,
      locale: mobiscroll.locale.ar,
      resources: myResources,
      view: {
        timeline: { type: 'day' },
      },
    })
    .mobiscroll('getInst');

  $.getJSON('https://trial.mobiscroll.com/timeline-events/', function (events) {
    gregorian.setEvents(events);
    jalali.setEvents(events);
    hijri.setEvents(events);
  });
});
```

### 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, each using `timeline: { type: 'day' }` and the same 6 resources (`id`, `name`, `color`).
- Load events once from `https://trial.mobiscroll.com/timeline-events/` via JSONP using `getJson(url, callback, 'jsonp')`. In the callback, share the same events array across all three instances: React/Angular/Vue assign it to the reactive state/property bound to each instance's `data` prop; for the imperative API (JS/jQuery), call `inst.setEvents(events)` on each of the three instances.
- **Gregorian instance** - no `calendarSystem` needed (Gregorian is the default). Pass `locale: localeEn` (or omit for the default).
- **Jalali instance** - pass `calendarSystem: jalaliCalendar` and `locale: localeFa`. `jalaliCalendar` and `localeFa` are imported from the Mobiscroll package.
- **Hijri instance** - pass `calendarSystem: hijriCalendar` and `locale: localeAr`. `hijriCalendar` and `localeAr` are imported from the Mobiscroll package.
- Wrap the page in a Mobiscroll `Page` component. Use a Mobiscroll grid (`mbsc-grid` / `mbsc-row`) with three equal columns (`mbsc-col-sm-12 mbsc-col-md-4`). Each column contains a `mbsc-form-group` with a `mbsc-form-group-title` label ("Gregorian calendar", "Jalali calendar", "Hijri calendar") above its `Eventcalendar` instance.

## Run it in your project

1. If not signed up yet, or don't own a license, you can [start a free trial](https://mobiscroll.com/starttrial).

2. Clone the repository:

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

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

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

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

   ```
   mobiscroll config jquery
   ```

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 jquery --trial`.

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

## Related demos

- Next: [Event Hooks](https://demo.mobiscroll.com/jquery/timeline/event-hooks.md) - Explore JQuery Timeline lifecycle hooks — see hooks fire on event clicks, initialization, and date changes, tracked in a live event log.
