This is the documentation of version 1.0.0-rc.4. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Type Alias DepartArriveParams<Option>

    DepartArriveParams: { option: Option } & (
        | { date: Date; localDateTime?: never }
        | { date?: never; localDateTime: LocalDateTime }
    )

    The departure or arrival time for route planning.

    It sets either when to depart from the origin or when to arrive at the destination. The routing engine then optimises the route for that time window, considering traffic patterns for that time of day.

    Pass exactly one of date, an instant, and localDateTime, a wall-clock time the routing API reads in the local time zone of the place it applies to.

    Type Parameters

    • Option extends DepartArriveOption = DepartArriveOption

      Whether this specifies departure or arrival time

    Type Declaration

    • option: Option

      Whether to specify a departure or arrival time.

      • departAt calculates the route forward from this departure time.
      • arriveBy calculates the route backward to arrive by this time.
    • { date: Date; localDateTime?: never }
      • date: Date

        The instant to depart or arrive.

        If you pass a past date, or one that is impossible to achieve (such as an imminent arrival date for a very long route), the route defaults to departing immediately.

        The date is sent in UTC. For a wall-clock time at the origin, use localDateTime instead.

      • OptionallocalDateTime?: never
    • { date?: never; localDateTime: LocalDateTime }
      • Optionaldate?: never
      • localDateTime: LocalDateTime

        The wall-clock time to depart or arrive, without a UTC offset.

        localDateTime is a wall-clock time without an offset, read in the origin's time zone. With arriveBy, it is read in the time zone of the route's final destination instead.

        The response's summary.departureTime and summary.arrivalTime carry the instants it resolved to. A past or unreachable time defaults to departing immediately, as with date.

    Traffic conditions vary significantly by:

    • Time of day (rush hour vs off-peak)
    • Day of week (weekday vs weekend)
    • Special events or holidays

    Specifying a departure or arrival time enables the router to:

    • Use appropriate traffic data for that time
    • Plan around rush hour or quiet periods
    • Calculate accurate arrival/departure times
    • Account for time-dependent road restrictions
    // Depart at 08:15 in Tokyo, wherever the code runs
    const departParams: DepartArriveParams = {
    option: 'departAt',
    localDateTime: '2026-10-19T08:15:00'
    };

    // Arrive by an instant (catch a flight)
    const arriveParams: DepartArriveParams = {
    option: 'arriveBy',
    date: new Date('2025-10-20T14:00:00+02:00')
    };