import { Dayjs } from 'dayjs'; import { PickerMode, RangeValue } from 'bonree-picker/lib/interface'; import { PickerLocale } from './generatePicker'; import 'dayjs/locale/en-gb'; export declare const MAX_DURATION = 86400000000; export declare const getCommonTimeZoneConfig: () => { timeZone?: string; tzOffset?: string; }; /** 获取指定时区的当前时间;无效或未传时区时保持原有的本地时区行为。 */ export declare const getTimeZoneNow: (timeZone?: string | undefined, tzOffset?: string | undefined) => Dayjs; /** 仅按指定时区格式化,不改变传入值代表的时间点。 */ export declare const formatInTimeZone: (date: Dayjs, format: string, timeZone?: string | undefined, tzOffset?: string | undefined) => string; export declare const getTimeZoneStartOfDay: (timeZone?: string | undefined, tzOffset?: string | undefined) => Dayjs; export declare const getTimeZoneEndOfDay: (timeZone?: string | undefined, tzOffset?: string | undefined) => Dayjs; export interface _SpecialDate { enable?: boolean; name?: string; dates?: string[]; times?: string[]; } export declare type SpecialDate = _SpecialDate | null; export declare function getPlaceholder(picker: PickerMode | undefined, locale: PickerLocale, customizePlaceholder?: string): string; export declare function getRangePlaceholder(picker: PickerMode | undefined, locale: PickerLocale, customizePlaceholder?: [string, string]): [string, string] | undefined; export declare enum GlobalPickerType { shortcut = 1, custom = 2, recently = 3, special = 4 } export declare function getTargetFromEvent(e: Event): HTMLElement; export declare function elementsContains(elements: (HTMLElement | undefined | null)[], target: HTMLElement): boolean; declare type ClickEventHandler = (event: MouseEvent) => void; export declare function addGlobalMouseDownEvent(callback: ClickEventHandler): () => void; export declare const generateRefreshOptions: (locale?: Record | undefined) => { label: any; value: number; }[]; export declare const isAbsoluteTime: (value: string) => boolean; export declare const isRelativeTime: (value: string) => boolean; export declare const isSpecialTime: (value: string) => boolean; export declare const multiSpaceToOne: (value: string) => string; export declare function valueToShortcut(value: string): { type: GlobalPickerType; label: string; value: string; }; export declare function computedDuration(dates: RangeValue): Record | undefined; export declare function durationText(dates: RangeValue, maxDuration: number, locale?: Record): { isInvalid: boolean; isGreater: boolean; isEqual: boolean; formatString: any; }; export declare function datesToValue(dates: RangeValue, timeZone?: string, tzOffset?: string): string; export declare const parseShortcutValue: (value?: string | undefined, timeZone?: string | undefined, tzOffset?: string | undefined) => RangeValue; /** * Convert only absolute wall-time fragments in a shortcut value between time zones. * Relative and special-time expressions must stay relative to the time when they are used. */ export declare const convertShortcutValueTimeZone: (value: string, sourceTimeZone?: string | undefined, sourceTzOffset?: string | undefined, targetTimeZone?: string | undefined, targetTzOffset?: string | undefined) => string; /** * Build a timezone-independent identity for an absolute range. Dynamic shortcut values keep * their normalized expression as identity because converting them to timestamps is unstable. */ export declare const getShortcutValueId: (value: string, timeZone?: string | undefined, tzOffset?: string | undefined) => string; export interface ShortcutOption { id?: string; type?: GlobalPickerType; label: string; value: string; timeZone?: string; tzOffset?: string; } export interface ShortcutTimeZoneConfig { timeZone?: string; tzOffset?: string; } export declare const createRecentShortcutOption: (shortcut: ShortcutOption, value: string, timeZone?: string | undefined, tzOffset?: string | undefined) => ShortcutOption; export declare const normalizeCachedShortcutOptions: (shortcuts: ShortcutOption[], targetTimeZone?: string | undefined, targetTzOffset?: string | undefined, fallbackTimeZoneConfig?: ShortcutTimeZoneConfig) => { options: ShortcutOption[]; migratedValues: Map; }; export declare const upsertShortcutOptionById: (shortcuts: ShortcutOption[], shortcut: ShortcutOption, maxLength?: number) => ShortcutOption[]; export declare const computeShortcutOptions: (locale: Record) => ShortcutOption[]; export declare const parseSpecialTime: (value: string, specialDate: SpecialDate, timeZone?: string | undefined, tzOffset?: string | undefined) => RangeValue; export declare const filterShortcutsByMaxDuration: (shortcuts: ShortcutOption[], maxDuration: number, specialDate?: SpecialDate | undefined, timeZone?: string | undefined, tzOffset?: string | undefined) => ShortcutOption[]; export declare const computedSpecialList: (locale: Record, specialDate: SpecialDate, maxDuration?: number | undefined, timeZone?: string | undefined, tzOffset?: string | undefined) => ShortcutOption[]; export declare const isRelatveOpt: (opt: ShortcutOption) => boolean; export declare const isSpecialOpt: (opt: ShortcutOption) => boolean; export declare const isRecentOpt: (opt: ShortcutOption) => boolean; export declare function isInSpecial(currentDate: Dayjs, specialDate?: SpecialDate, timeZone?: string, tzOffset?: string): boolean; export declare const timezonesToOffset: (tz: string) => string; /** 获取实际生效的 UTC 偏移文本;合法的 tzOffset 优先于 timeZone。 */ export declare const getUtcOffsetText: (timeZone?: string | undefined, tzOffset?: string | undefined) => string; export {};