---
title: "React Range Date & Time Range Picker Example | Mobiscroll"
component: "Range"
framework: "React"
library_version: "6.2.0"
url: "https://demo.mobiscroll.com/react/range/date-time-range"
---

# Date & Time Range Picker - React Range demo

Pick start and end date-times with the React range picker — choose from calendar, time grid, or date-time scroller, with single or split input layouts. For React and Next.JS.

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

## Description

Set up the range picker for date & time pair selection. Regardless if you are interested in the start/end date or the actual range, you have several possibilities of rendering a date and time range picker. The `controls` option supports different values:

- `datetime` - will render a compact date scroller or dropdown with time picker for date & time range selection
- `calendar` - will render a calendar view for date range selection ([explore date ranges](https://demo.mobiscroll.com/react/range/date-range))
- `date` - will render a date scroller or dropdown for date range selection ([explore date ranges](https://demo.mobiscroll.com/react/range/date-range))
- `time` - will render a time picker for range selection ([explore time ranges](https://demo.mobiscroll.com/react/range/time-range))
- `timegrid` - will render a time grid for range selection ([explore time range selection](https://demo.mobiscroll.com/react/range/time-range))

## What this demo shows

- Five inline examples of date-and-time range selection, each using a different control configuration.
- **Calendar + time picker** A month calendar for date selection combined with a time picker, giving a familiar two-panel layout for picking start and end date-times.
- **Calendar + time grid** A month calendar paired with a time grid at 30-minute increments, suited for slot-based selection.
- **Date-time scroller** A compact inline scroller combining date and time in a single control for both the start and end values.
- **Single input with popover/dropdown** One input field that opens a date-time range scroller as a popover on mobile and as a dropdown on desktop.
- **Separate start and end inputs** Same responsive behavior as the single-input example, but with dedicated input fields for the start and end date-time. In all examples the selected start and end date-times are displayed above the picker component.

## Best for

- **Flexible form configurations** The five examples cover the most common form layouts: fully inline, single-input, and split start/end inputs, making it easy to pick the right pattern for a given form design.
- **Use-cases that need both date and time precision** Booking systems, scheduling tools, or any workflow where selecting just a date is not enough and the time component is required for both ends of the range.
- **Responsive UIs** The popover/dropdown examples demonstrate how the same control adapts between mobile and desktop without additional configuration.

## Tutorial

### Range with a calendar and time picker

One of the most common ways to represent date range selection is through a calendar with or without a time picker. Learn how to build [a date-only picker](https://demo.mobiscroll.com/react/range/date-range).

```jsx
<Datepicker
    controls={['calendar', 'time']}
    select="range"
    display="inline"
    touchUi={true}
/>
```

### Range with a calendar and time grid

Instead of selecting time from a list of values you can show a grid by passing `'timegrid'` to the `controls` option.

```jsx
<Datepicker
    controls={['calendar', 'timegrid']}
    select="range"
    display="inline"
    touchUi={true}
/>
```

### Range with a scroller/dropdown

Passing `datetime` to the `controls` option renders a compact date scroller and a time scroller or dropdown with [customizable start and end labels](https://demo.mobiscroll.com/react/range/customizing-labels-selection).

```jsx
<Datepicker
    controls={['datetime']}
    select="range"
    display="inline"
    touchUi={true}
/>
```

### Using the range with one input

Besides rendering it inline, you can link the range to an input that can be a Mobiscroll input or an existing field. Explore [more ways to use the picker](https://demo.mobiscroll.com/react/range/usage-on-input-or-inline).

```jsx
<Datepicker
    controls={['datetime']}
    select="range"
    touchUi={true}
/>
```

### Using the range with two inputs

Sometimes it makes sense to use two separate inputs for `start` and `end`. You can pass a reference through the `startInput` and `endInput` options of mobiscroll or any type of input, like an `ion-input`.

```jsx
const [start, startRef] = React.useState(null);
const [end, endRef] = React.useState(null);
                            
<Datepicker
    controls={['datetime']}
    select="range"
    startInput={start}
    endInput={end}
    touchUi={true}
/>
<Input
    ref={startRef}
    placeholder="Please Select...">Start
</Input>
<Input
    ref={endRef}
    placeholder="Please Select...">End
</Input>
```

## 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
- [`select`](https://mobiscroll.com/docs/react/datepicker/api#opt-select) - option
- [`display`](https://mobiscroll.com/docs/react/datepicker/api#opt-display) - option
- [`labelStyle`](https://mobiscroll.com/docs/react/datepicker/api#opt-labelStyle) - option
- [`inputStyle`](https://mobiscroll.com/docs/react/datepicker/api#opt-inputStyle) - option
- [`startInput`](https://mobiscroll.com/docs/react/datepicker/api#opt-startInput) - option
- [`endInput`](https://mobiscroll.com/docs/react/datepicker/api#opt-endInput) - option

## Code

### JSX

```jsx
import { Datepicker, Input, Page, setOptions } from '@mobiscroll/react';
import { useState } from 'react';

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

function App() {
  const [start, startRef] = useState(null);
  const [end, endRef] = useState(null);

  return (
    <Page>
      <Datepicker controls={['calendar', 'time']} select="range" display="inline" />
      <Datepicker controls={['calendar', 'timegrid']} select="range" display="inline" />
      <Datepicker controls={['datetime']} select="range" display="inline" />
      <Datepicker
        controls={['datetime']}
        select="range"
        label="Range"
        labelStyle="stacked"
        inputStyle="outline"
        placeholder="Please Select..."
      />

      <Datepicker controls={['datetime']} select="range" startInput={start} endInput={end} />
      <div className="mbsc-grid mbsc-no-padding">
        <div className="mbsc-row">
          <div className="mbsc-col-6">
            <Input ref={startRef} label="Start" labelStyle="stacked" inputStyle="outline" placeholder="Please Select..."></Input>
          </div>
          <div className="mbsc-col-6">
            <Input ref={endRef} label="End" labelStyle="stacked" inputStyle="outline" placeholder="Please Select..."></Input>
          </div>
        </div>
      </div>
    </Page>
  );
}

export default App;
```

### TSX

```tsx
import { Datepicker, Input, Page, setOptions } from '@mobiscroll/react';
import { FC, useState } from 'react';

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

const App: FC = () => {
  const [start, startRef] = useState<Input | null>(null);
  const [end, endRef] = useState<Input | null>(null);

  return (
    <Page>
      <Datepicker controls={['calendar', 'time']} select="range" display="inline" />
      <Datepicker controls={['calendar', 'timegrid']} select="range" display="inline" />
      <Datepicker controls={['datetime']} select="range" display="inline" />
      <Datepicker
        controls={['datetime']}
        select="range"
        label="Range"
        labelStyle="stacked"
        inputStyle="outline"
        placeholder="Please Select..."
      />

      <Datepicker controls={['datetime']} select="range" startInput={start} endInput={end} />
      <div className="mbsc-grid mbsc-no-padding">
        <div className="mbsc-row">
          <div className="mbsc-col-6">
            <Input ref={startRef} label="Start" labelStyle="stacked" inputStyle="outline" placeholder="Please Select..."></Input>
          </div>
          <div className="mbsc-col-6">
            <Input ref={endRef} label="End" labelStyle="stacked" inputStyle="outline" placeholder="Please Select..."></Input>
          </div>
        </div>
      </div>
    </Page>
  );
};
export default App;
```

## Implementation notes

- Set `select: 'range'` on the `Datepicker` for every configuration below - it is what turns single-value selection into start/end range selection.
- Use `controls: ['calendar', 'time']` for a calendar paired with a scroller-style time picker, or `controls: ['calendar', 'timegrid']` to pair the calendar with a 30-minute time grid instead of scroller wheels.
- Use `controls: ['datetime']` alone for the compact combined date-and-time scroller/dropdown layout (both inline and input-anchored).
- Set `display: 'inline'` to render the picker directly on the page, or omit `display` (default `'anchored'`) to open it from an input.
- For a single input driving the whole range, initialize the picker directly on that input element/ref.
- For two separate start/end inputs, initialize the picker once and pass `startInput`/`endInput` pointing at the two input elements/refs - React/Vue/Angular pass element refs (`startInput={start}` / `:startInput="startInput"` / `[startInput]="start"`), JS/jQuery pass selector strings (`startInput: '#start'`, `endInput: '#end'`).

## 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: [Time Range Picker](https://demo.mobiscroll.com/react/range/time-range.md) - Select start and end times with the React time range picker — choose inline scroller, time grid, or single/split input layouts.
- Next: [Range Picker Customization](https://demo.mobiscroll.com/react/range/week-month-view-scrolling-direction.md) - Show multiple months or weeks in the React date range picker calendar — set scroll direction, display count, week numbers, and outer day visibility.
