diff --git a/src/features/online-board/types.test.ts b/src/features/online-board/types.test.ts index 7a39d74f..69bbf881 100644 --- a/src/features/online-board/types.test.ts +++ b/src/features/online-board/types.test.ts @@ -22,6 +22,7 @@ import type { IAircraftInfo, IEquipmentFull, IDaysOfWeek, + IDuration, } from "./types.js"; /** @@ -301,4 +302,21 @@ describe("online-board types extension", () => { }; expect(leg.daysOfWeek?.flight).toBe("1111111"); }); + + it("IDuration has days/hours/minutes and optional isNegative", () => { + const d: IDuration = { days: 0, hours: 1, minutes: 30, isNegative: true }; + expect(d.days).toBe(0); + expect(d.hours).toBe(1); + expect(d.minutes).toBe(30); + expect(d.isNegative).toBe(true); + }); + + it("IFlightLeg accepts optional estimatedDuration and scheduledDuration", () => { + const leg: Partial = { + estimatedDuration: { days: 0, hours: 1, minutes: 30 }, + scheduledDuration: { days: 0, hours: 1, minutes: 45 }, + }; + expect(leg.estimatedDuration?.hours).toBe(1); + expect(leg.scheduledDuration?.minutes).toBe(45); + }); }); diff --git a/src/features/online-board/types.ts b/src/features/online-board/types.ts index 4d0b7bc8..d58c9812 100644 --- a/src/features/online-board/types.ts +++ b/src/features/online-board/types.ts @@ -113,6 +113,21 @@ export interface IDaysOfWeek { flight: string; } +// --------------------------------------------------------------------------- +// Duration +// --------------------------------------------------------------------------- + +/** + * Structured duration for flight timings. `isNegative` flags an uncertain + * or "specifying" state (estimated arrival is earlier than departure). + */ +export interface IDuration { + days: number; + hours: number; + minutes: number; + isNegative?: boolean; +} + // --------------------------------------------------------------------------- // Transition (registration/boarding/deboarding) // --------------------------------------------------------------------------- @@ -180,6 +195,8 @@ export interface IFlightLeg { updated: string; transition?: IFlightTransitions; daysOfWeek?: IDaysOfWeek; + estimatedDuration?: IDuration; + scheduledDuration?: IDuration; } // ---------------------------------------------------------------------------