---
title: "React Date & Time Calendar systems  Example | Mobiscroll"
component: "Date & Time"
framework: "React"
library_version: "6.1.5"
url: "https://demo.mobiscroll.com/react/datetime/gregorian-jalali-hijri"
---

# Calendar systems - React Date & Time demo

React Date & time supporting calendar systems: Gregorian, Hijri and Jalali along with different languages and cultures. For React and Next.JS.

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

## Description

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

## What this demo shows

- Shows a wheel-style inline date picker with different 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.
- **Inline date picker** The example embeds the picker directly in the page without an input by using inline display mode.
- **Date selection** Separate scrollable wheels let users select the month, day, and year. The selected values appear in a central selection area, while neighboring values remain visually subdued.
- **Scrolling behavior** Users can scroll vertically through neighboring values to move between dates, including dates in other months or years.

## 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.

## Tutorial

### Pick a calendar system

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

```jsx
<Datepicker
    locale={localeEn}
/>
```

With "Jalali":

```jsx
<Datepicker
    calendarSystem={jalaliCalendar}
    locale={localeFa}
/>
```

With "Hijri":

```jsx
<Datepicker
    calendarSystem={hijriCalendar}
    locale={localeAr}
/>
```

## API used in this demo

- [`theme`](https://mobiscroll.com/docs/react/datepicker/api#opt-theme) - option
- [`themeVariant`](https://mobiscroll.com/docs/react/datepicker/api#opt-themeVariant) - option
- [`controls`](https://mobiscroll.com/docs/react/datepicker/api#opt-controls) - option
- [`display`](https://mobiscroll.com/docs/react/datepicker/api#opt-display) - option
- [`calendarSystem`](https://mobiscroll.com/docs/react/datepicker/api#localization-calendarSystem) - option
- [`locale`](https://mobiscroll.com/docs/react/datepicker/api#localization-locale) - option

## Code

### JSX

```jsx
import { Datepicker, hijriCalendar, jalaliCalendar, localeAr, localeFa, setOptions } from '@mobiscroll/react';

setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

function App() {
  return (
    <div>
      <Datepicker controls={['date']} display="inline" />
      <Datepicker controls={['date']} display="inline" calendarSystem={jalaliCalendar} locale={localeFa} />
      <Datepicker controls={['date']} display="inline" calendarSystem={hijriCalendar} locale={localeAr} />
    </div>
  );
}

export default App;
```

### TSX

```tsx
import { Datepicker, hijriCalendar, jalaliCalendar, localeAr, localeFa, setOptions } from '@mobiscroll/react';
import { FC } from 'react';

setOptions({
  theme: 'ios',
  themeVariant: 'light'
});

const App: FC = () => (
  <div>
    <Datepicker controls={['date']} display="inline" />
    <Datepicker controls={['date']} display="inline" calendarSystem={jalaliCalendar} locale={localeFa} />
    <Datepicker controls={['date']} display="inline" calendarSystem={hijriCalendar} locale={localeAr} />
  </div>
);
export default App;
```

## Implementation notes

- Use `controls: ['date']` and `display: 'inline'` on a single inline `Datepicker` (wheel-style, not the month-grid `calendar` control). `calendarSystem` and `locale` can be changed at runtime via `setOptions({ calendarSystem, locale })` on the same instance to switch between calendar systems.
- The picker initializes with no `calendarSystem`/`locale` set, defaulting to Gregorian/English. Selecting `Jalali` sets `calendarSystem: jalaliCalendar` with `locale: localeFa`; selecting `Hijri` sets `calendarSystem: hijriCalendar` with `locale: localeAr`; selecting `Gregorian` again explicitly sets `calendarSystem: gregorianCalendar` with `locale: localeEn` - `gregorianCalendar` and `localeEn` are real exports/namespace members used to switch back, not options the API lacks.
- React/Angular/Vue import `gregorianCalendar`, `jalaliCalendar`, `hijriCalendar`, `localeEn`, `localeFa`, `localeAr` as named exports from `@mobiscroll/react`/`@mobiscroll/angular`/`@mobiscroll/vue`; JS/jQuery reference them off the `mobiscroll` namespace (`mobiscroll.gregorianCalendar`, `mobiscroll.jalaliCalendar`, `mobiscroll.hijriCalendar`, `mobiscroll.locale.en`, `mobiscroll.locale.fa`, `mobiscroll.locale.ar`).
- The `locale` supplies month/day names and RTL layout direction alongside the calendar system's date rules for the non-Gregorian systems.

## 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-react.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 react
   ```

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

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

## Related demos

- Previous: [Lifecycle events](https://demo.mobiscroll.com/react/datetime/event-hooks.md) - React Date and time for mobile and desktop with event hooks for custom integration and functionality. With source code.
- Next: [Localization](https://demo.mobiscroll.com/react/datetime/localization.md) - React Date & time picker localization example supporting 37 languages, date, time formats with full RTL capability.
