/** * This Source Code is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright (c) Infonomic Company Limited */ export interface ScheduledPublicationInstantChoice { iso: string; offsetLabel: string; } /** * A wall time as the editor sees it: a calendar day and a clock reading, with * no instant attached yet. * * The schedule modal takes these two halves from the date picker's * `onWallTimeChange` and keeps them as strings all the way to * `resolveScheduledPublicationWallTime`, never routing them through a `Date`. * That is deliberate: `setHours` silently normalizes a nonexistent wall time (a * spring-forward 02:30 becomes 03:30) and silently picks the first of two * ambiguous instants at a fall-back overlap. Both are exactly the cases the * editor has to be asked about, so the only safe carrier between the picker and * the resolver is text. */ export interface ScheduledPublicationWallTime { /** Calendar day as `YYYY-MM-DD`. */ date: string; /** Clock reading as `HH:mm`, 24-hour. */ time: string; } export type ScheduledPublicationWallTimeResolution = { status: 'invalid'; } | { status: 'nonexistent'; } | { status: 'valid'; choices: ScheduledPublicationInstantChoice[]; }; /** * Resolve a browser-entered wall time in an explicit IANA zone. Returns no * choice for a daylight-saving gap and two choices for an overlap, forcing * the editor to choose an actual instant rather than accepting JS Date's * silent normalization. */ export declare function resolveScheduledPublicationWallTime(value: string, timeZone: string): ScheduledPublicationWallTimeResolution; /** * Split an instant into the calendar day and clock reading it shows in * `timeZone`. Used to seed the modal when rescheduling, so the editor starts * from the time they authorized rather than from its UTC spelling. */ export declare function wallTimeInZone(instant: Date, timeZone: string): ScheduledPublicationWallTime; /** * Join a wall time back into the `YYYY-MM-DDTHH:mm` string that * `resolveScheduledPublicationWallTime` parses. Returns null when either half * is still blank, which is the modal's "nothing to validate yet" signal. */ export declare function joinWallTime(wall: ScheduledPublicationWallTime): string | null;