36-Hour Rolling Window Schedule

The timeline component is ideal for highly dynamic resource management scenarios, such as tracking a global aircraft fleet, offering a powerful visualization solution. The primary technical focus is on creating a 36-hour continuous, forward-looking window that automatically updates to start from the current hour, providing an adaptive "rolling" schedule view.

To implement the dynamic 36-hour window, a single-day timeline view is configured. The startTime and endTime properties are calculated in JavaScript based on the current system time prior to initialization. This calculation ensures the view always spans exactly 36 hours ahead, which is achieved by setting the endTime with a calculated date offset (e.g., +1 or +2 days) to leverage the shifted days feature for continuous rendering. The time axis resolution is hourly, which is optimal for monitoring time-sensitive flights and maintenance events.

The resources, representing individual aircraft (tail numbers), are organized in a hierarchical structure (e.g., Airbus A350-900/Base: LAX → N351AD). This grouping allows managers to quickly drill down from a fleet level to an individual aircraft's current status. Events, which represent flights, are labeled concisely with common IATA airport codes (e.g., "JFK → LHR") for immediate route identification.

Get started with this example

Demo

Loading the live demo

Preview in full screen

Build a fleet scheduling view on the Timeline — a 36-hour rolling window that auto-advances from the current hour.

Code

import { dayjsTimezone, Eventcalendar, setOptions  } from '@mobiscroll/react';
import dayjs from 'dayjs';
import utc from 'dayjs/plugin/utc';
import { useCallback, useMemo } from 'react';

dayjs.extend(utc);

setOptions({
  locale:  ,
  theme: ' ',
  themeVariant: ' '
});

function App() {
  const startTime = useMemo(() => dayjs.utc().format('HH:00'), []);

  const endTime = useMemo(() => {
    const start = dayjs.utc().startOf('hour');
    const end = start.add(36, 'hours');
    const dayOffset = end.subtract(1, 'minute').startOf('day').diff(start.startOf('day'), 'days');
    const suffix = dayOffset > 0 ? '+' + dayOffset : '';
    return end.format('HH:00') + suffix;
  }, []);

  const myEvents = useMemo(
    () => [
      {
        resource: '1-1',
        title: 'DXB → BKK',
        start: '2026-10-27T08:30',
        end: '2026-10-27T14:45',
        color: '#22c55e',
      },
      {
        resource: '1-1',
        title: 'BKK → SIN',
        start: '2026-10-27T20:30',
        end: '2026-10-27T23:00',
        color: '#22c55e',
      },
      {
        resource: '1-1',
        title: 'SIN → CDG',
        start: '2026-10-28T04:30',
        end: '2026-10-28T15:00',
        color: '#22c55e',
      },
      {
        resource: '1-1',
        title: 'CDG → GVA',
        start: '2026-10-28T21:30',
        end: '2026-10-28T22:45',
        color: '#22c55e',
      },
      {
        resource: '1-2',
        title: 'JFK → AMS',
        start: '2026-10-27T21:00',
        end: '2026-10-28T08:30',
        color: '#3b82f6',
      },
      // Showing partial data. Download full source.
    ],
    [],
  );

  const myResources = useMemo(
    () => [
      {
        id: '1',
        name: 'A330-200 / DXB',
        eventCreation: false,
        children: [
          {
            id: '1-1',
            name: 'A6-ECC',
          },
          {
            id: '1-2',
            name: 'A6-AFA',
          },
          {
            id: '1-3',
            name: 'A6-DHB',
          },
        ],
      },
      {
        id: '2',
        name: 'A330-300 / JFK',
        eventCreation: false,
        children: [
          {
            id: '2-1',
            name: 'N733AL',
          },
          {
            id: '2-2',
            name: 'N338UA',
          },
          {
            id: '2-3',
            name: 'N412NY',
          },
        ],
      },
      // Showing partial data. Download full source.
    ],
    [],
  );

  const myView = useMemo(
    () => ({
      timeline: {
        type: 'day',
        startTime,
        endTime,
      },
    }),
    [startTime, endTime],
  );

  const customResourceHeader = useCallback(
    () => (
      <div className="mds-36-hour-resource-header">
        TIMES SHOWN IN <span className="mds-36-hour-resource-header-utc">UTC</span>
      </div>
    ),
    [],
  );

  return (
    <Eventcalendar
      cssClass="mds-36-hour-rolling-calendar"
      data={myEvents}
      dataTimezone="utc"
      displayTimezone="utc"
      view={myView}
      resources={myResources}
      showControls={false}
      renderResourceHeader={customResourceHeader}
      timezonePlugin={dayjsTimezone}
    />
  );
}

export default App;

Duplicate Session

You have signed in on a different machine. To keep everything in sync, you have been signed out of this session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.

Duplicate Session

We noticed you are logged in on a different machine and have closed your old session.

If you need to invite team members, manage seats and accounts you can do it from the licenses page.