UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

80 lines (79 loc) 3.4 kB
import { NumberingSystem, SupportedLocale } from './locale'; export type FractionalSecondDigits = 1 | 2 | 3; export type EffectiveHourFormat = "12" | "24"; export type HourFormat = "user" | EffectiveHourFormat; export declare const hourFormats: EffectiveHourFormat[]; export interface LocalizedTime { hour: string; hourSuffix: string; minute: string; minuteSuffix: string; second: string; decimalSeparator: string; fractionalSecond: string; secondSuffix: string; meridiem: string; } export type Meridiem = "AM" | "PM"; export type MinuteOrSecond = "minute" | "second"; export interface Time { fractionalSecond?: string; hour: string; minute: string; second?: string; } export type TimePart = "hour" | "hourSuffix" | "minute" | "minuteSuffix" | "second" | "decimalSeparator" | "fractionalSecond" | "secondSuffix" | "meridiem"; export declare const maxTenthForMinuteAndSecond = 5; export declare function formatTimePart(number: number, minLength?: number): string; export declare function getLocaleHourFormat(locale: SupportedLocale): EffectiveHourFormat; /** * To reference the CLDR meridiems for each supported locale navigate to: * https://github.com/unicode-org/cldr-json/tree/main/cldr-json/cldr-dates-full/main, * click {locale}/ca-generic.json and drill down to main.{locale}.dates.calendars.generic.dayPeriods.format.abbreviated. * * @param locale.locale * @param locale * @param meridiem * @param parts * @param locale.meridiem * @param locale.parts */ export declare function getLocalizedMeridiem({ locale, meridiem, parts: fromParts, }: { locale: SupportedLocale; meridiem?: Meridiem; parts?: Intl.DateTimeFormatPart[]; }): string; export declare function getLocalizedDecimalSeparator(locale: SupportedLocale, numberingSystem: NumberingSystem): string; export declare function getLocalizedTimePartSuffix(part: "hour" | "minute" | "second", locale: SupportedLocale, numberingSystem?: NumberingSystem): string; export declare function getMeridiem(hour: string): Meridiem; export declare function getMeridiemOrder(locale: SupportedLocale): number; export declare function isValidTime(value: string | Time): boolean; interface LocalizeTimePartParameters { value: string; part: TimePart; locale: SupportedLocale; numberingSystem?: NumberingSystem; hour12?: boolean; } export declare function localizeTimePart({ value, part, locale, numberingSystem, hour12, }: LocalizeTimePartParameters): string; interface LocalizeTimeStringParameters { hour12?: boolean; includeSeconds?: boolean; locale: SupportedLocale; numberingSystem?: NumberingSystem; parts?: boolean; step?: number; value: string; } export declare function localizeTimeString({ hour12, includeSeconds, locale, numberingSystem, parts: toParts, step, value, }: LocalizeTimeStringParameters): string | LocalizedTime; interface LocalizeTimeStringToPartsParameters { hour12?: boolean; locale: SupportedLocale; numberingSystem?: NumberingSystem; step: number; value: string; } export declare function localizeTimeStringToParts({ hour12, locale, numberingSystem, step, value, }: LocalizeTimeStringToPartsParameters): LocalizedTime; export declare function parseTimeString(value: string, step?: number): Time; export declare function toISOTimeString(value: string | Time, step?: number): string; export {};