---
title: "Javascript Date & Time RTL mode Example | Mobiscroll"
component: "Date & Time"
framework: "JavaScript"
library_version: "6.1.5"
url: "https://demo.mobiscroll.com/javascript/datetime/rtl-right-to-left"
---

# RTL mode - JavaScript Date & Time demo

Javascript datetime picker with RTL support. Manual control and built-in right to left languages: Arabic, Hebrew, Farsi. Plain JavaScript API.

- [Live demo](https://demo.mobiscroll.com/javascript/datetime/rtl-right-to-left)
- [View code on GitHub](https://github.com/acidb/mobiscroll-demos-javascript/tree/main/src/demos/datepicker/datetime/rtl-right-to-left)
- This demo in other frameworks: [jQuery](https://demo.mobiscroll.com/jquery/datetime/rtl-right-to-left.md), [Angular](https://demo.mobiscroll.com/angular/datetime/rtl-right-to-left.md), [React](https://demo.mobiscroll.com/react/datetime/rtl-right-to-left.md), [Vue](https://demo.mobiscroll.com/vue/datetime/rtl-right-to-left.md)

## Description

RTL support is built in and can be explicitly controlled through the `rtl` option. If not set, it is inherited from the [`locale`](https://mobiscroll.com/docs/javascript/datepicker/api#localization-locale) settings.

**Explore the different locales** [Check out this example →](https://demo.mobiscroll.com/javascript/datetime/localization)

## What this demo shows

- Shows a wheel-style inline date picker with RTL mode enabled.
- **RTL control** A side panel next to the date picker includes an `Enable Right-To-Left rendering` switch, which is enabled by default.
- **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 AM/PM, minute, hours and the exact date. 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

- **RTL interfaces** Building date picker calendars for products used in right-to-left languages such as Arabic, Hebrew, or Farsi.
- **Multilingual applications** Supporting users who need the same date picker workflow in both LTR and RTL rendering modes.

## Tutorial

### Enable Right-To-Left rendering

- [x] Turn RTL on

```js
mobiscroll.datepicker('#datetime', {
    rtl: true
});
```

## API used in this demo

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

## Code

### JS

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

mobiscroll.datepicker('#demo', {
  controls: ['datetime'],
  rtl: true,
  display: 'inline',
});
```

### HTML

```html
<div id="demo"></div>
```

## Implementation notes

- Use `controls: ['datetime']` and `display: 'inline'`.
- Set `rtl: true` to mirror the entire wheel layout - the AM/PM, minute, hour, and date wheel columns all flip order and direction, and all supporting UI text aligns right-to-left; `rtl: false` (or omitting it) renders left-to-right.
- Toggle at runtime via `setOptions({ rtl: true | false })` on the instance.
- Pair `rtl` with a matching RTL `locale` (e.g. `mobiscroll.locale.ar`, `mobiscroll.locale.he`) when the language itself is right-to-left, since `rtl` only controls layout direction, not translated day/month names.

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

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

Running a demo locally requires a Mobiscroll 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/javascript/datetime/localization.md) - Javascript Date & time picker localization example supporting 37 languages, date, time formats with full RTL capability.
