import { RR0Context } from "../../RR0Context.js"; import { Level2Date } from "@rr0/time"; /** * What a text must tell of the approximation of a time. */ export interface TimeApproximation { /** * The approximate components of the time ("year", "month", "day", "hour", "minute", "second"). */ components: ReadonlySet; /** * If the text already tells that the time is approximate, right before it ("vers"), so that no word should tell it again. */ said?: boolean; /** * If the approximation can be told before the time. It cannot after a preposition ("le vers jeudi 12"). */ leading?: boolean; } export declare class TimeTextBuilder { readonly options: Intl.DateTimeFormatOptions; /** * The names of the date components, from the coarsest to the finest. */ static readonly componentNames: string[]; static readonly dateOptions: (keyof Intl.DateTimeFormatOptions)[]; static readonly timeOptions: (keyof Intl.DateTimeFormatOptions)[]; /** * A time that tells nothing approximate. */ static readonly exact: TimeApproximation; /** * Reads the approximate components of a date, as EDTF scopes them: a qualification written after a component ("19:00~") * applies to it and to all the components before it, one written before a component ("~19:00") to that component only * (the components before it are also told approximate at their group level, but only as deduced from it). * * @param date The date to read the approximation of. * @return The names of its approximate components. */ static approximateComponents(date: Level2Date | undefined): Set; /** * @return If a text must tell an approximation. */ static tells(approximation: TimeApproximation): boolean; /** * @param context The context whose time to tell the approximation of. * @param said If the text already tells that the time is approximate. * @param leading If the approximation can be told before the time. */ static approximation(context: RR0Context, said?: boolean, leading?: boolean): TimeApproximation; /** * EDTF season codes (21-24) and their names, per language. */ static readonly seasons: Record>; static isSeason(month: number | undefined): boolean; /** * @param options The default date format.to use. */ constructor(options: Intl.DateTimeFormatOptions); /** * Build a textual representation of context's time, according to context's locale. * * @param context The context whose time to render. * @param options The date format to use. * @param approximation The approximation of the time to tell. None by default. */ build(context: RR0Context, options?: Intl.DateTimeFormatOptions, approximation?: TimeApproximation): string; /** * Renders the date and the time of day apart, as Intl joins them only when the date is complete ("jeudi 12 19 h"), * and tells their approximation. */ protected dateTimeText(context: RR0Context, date: Date, printOptions: Intl.DateTimeFormatOptions, approximation: TimeApproximation): string; }