# Leg

Industry: Transport, Intermodal

One leg of a multi-modal journey: a departure, how long it takes, and where it lands.

```ts
import type { Leg } from "@northguild/gmt";
```

## Members

| Member | Type | Description |
| --- | --- | --- |
| `departure?` | `string` | The departure: an instant (`Z`/offset) or a zoned string, always exact; on any leg but the first, a zoneless wall time is also accepted and is read in the previous leg's `timeZone` (the first leg's equivalent is `ScheduleDeliveryOptions.startTimeZone`). Required on the first leg; on later legs it is the scheduled connection the cargo waits for. |
| `duration` | `string` | The ISO 8601 duration of the leg; time units and 24-hour days only (`transitTime`'s rule). |
| `timeZone` | `string` | The time zone of the destination, the caller's fact: an IANA name or a UTC offset to the minute (what `isValidTimeZone` accepts). |
| `dwellAfter?` | `string` | The handling time at the handoff after this leg; the minimum connect time. |
| `mode?` | `string` | An opaque tag echoed back on the LegTime; GMT does not interpret transport modes. |
| `origin?` | `string` | An opaque tag echoed back on the LegTime; never resolved to a zone. |
| `destination?` | `string` | An opaque tag echoed back on the LegTime; never resolved to a zone. |

## Definition

```ts
interface Leg {
  /**
   * The departure: an instant (`Z`/offset) or a zoned string, always exact; on any leg but the
   * first, a zoneless wall time is also accepted and is read in the previous leg's `timeZone`
   * (the first leg's equivalent is `ScheduleDeliveryOptions.startTimeZone`). Required on the
   * first leg; on later legs it is the scheduled connection the cargo waits for.
   *
   * @defaultValue None. The leg leaves as soon as the previous leg's arrival plus its
   * `dwellAfter` allows; a first leg without it is invalid input.
   */
  departure?: string;
  /** The ISO 8601 duration of the leg; time units and 24-hour days only (`transitTime`'s rule). */
  duration: string;
  /**
   * The time zone of the destination, the caller's fact: an IANA name or a UTC offset to the minute
   * (what `isValidTimeZone` accepts).
   */
  timeZone: string;
  /**
   * The handling time at the handoff after this leg; the minimum connect time.
   *
   * @defaultValue `"PT0S"`
   */
  dwellAfter?: string;
  /**
   * An opaque tag echoed back on the LegTime; GMT does not interpret transport modes.
   *
   * @defaultValue None. The LegTime carries no `mode`.
   */
  mode?: string;
  /**
   * An opaque tag echoed back on the LegTime; never resolved to a zone.
   *
   * @defaultValue None. The LegTime carries no `origin`.
   */
  origin?: string;
  /**
   * An opaque tag echoed back on the LegTime; never resolved to a zone.
   *
   * @defaultValue None. The LegTime carries no `destination`.
   */
  destination?: string;
}
```

## Used by

- [`multimodalETA`](/gmt/reference/intermodal/calculate/multimodalETA/)
- [`scheduleDelivery`](/gmt/reference/transport/calculate/scheduleDelivery/)

## Source

[transport/calculate/scheduleDelivery.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/transport/calculate/scheduleDelivery.ts)
