import type { RequireAtLeastOne } from "./support/utility-types.js"; export type FormatPlainTimeOptions = Omit & { timeStyle?: "medium" | "short"; }; /** * Describes a basic time-of-day object with minimal properties. * * @see {@link PlainTime} factory for creating objects */ export interface ComPlainTime { /** Hour (1-23) */ hour: number; /** Minute (0-59) */ minute: number; /** Second (0-59) */ second: number; /** Millisecond (0-999) */ millisecond: number; /** `Thh:mm:ss.sss` (ISO 8601) */ iso: string; /** Tallied milliseconds since 00:00 */ valueOf: () => number; /** `hh:mm` / `hh:mm:ss` / `hh:mm:ss.sss` */ toString: () => string; /** `hh:mm` / `hh:mm:ss` / `hh:mm:ss.sss` */ toJSON: () => ReturnType; /** * Localize the time for display to a user. * * @param locale `Intl` {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument | locale }, defaults to system's locale if not given * @param options `Intl` {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat | format options }, defaults to "short" time-style if not given * * @example * ```ts * // "1:37 PM" * PlainTime({ hour: 13, minute: 37, second: 59, millisecond: 999 }).toLocaleString("en"); * * // "1:37:59 PM" * PlainTime({ hour: 13, minute: 37, second: 59, millisecond: 999 }).toLocaleString("en", { timeStyle: "medium" }); * * // "5" * PlainTime({ hour: 9, millisecond: 599 }).toLocaleString("en", { fractionalSecondDigits: 1 }); * ``` */ toLocaleString: (locale?: Intl.LocalesArgument, options?: FormatPlainTimeOptions) => string; /** * Check for partial or complete equality. */ is: (x: RequireAtLeastOne<{ hour?: number | string; minute?: number | string; second?: number | string; millisecond?: number | string; }>) => boolean; constructor: PlainTimeFactory; } /** * Describes a factory function that creates plain-time objects. */ export interface PlainTimeFactory { (x: { hour?: number | string; minute?: number | string; second?: number | string; millisecond?: number | string; }): T; } /** * Factory function for making basic plain-time objects with minimal properties. * * @param time A time object with optional properties `hour`, `minute`, `second` & `millisecond` * @returns A new immutable plain-time object * * @throws {RangeError} Input total must be less than 24 hours * @throws {RangeError} Input total can't be negative */ export declare function PlainTime({ hour, minute, second, millisecond }: { hour?: number | string; minute?: number | string; second?: number | string; millisecond?: number | string; }): ComPlainTime; //# sourceMappingURL=PlainTime.d.ts.map