import DateHelpers from '../baseui/datepicker/utils/date-helpers'; import { Locale } from '../locale'; import type { FormatSummaryValueOptions, TimeRangePreset } from './types'; export declare const getSelectedTimeRange: (selectedTimeRange: string | undefined, timeRangeOptions: Array) => TimeRangePreset | undefined; export declare const getSystemTzName: () => string; /** @param date: Date object or epoch in source timezone @param srcTz: source timezone @param targetTz: target timezone This function is used to convert the time from one timezone to another timezone. Example use-case of this function Lets say you want to find out what time it will be in New York when it is 6th Nov, 2022 00:00 in Los Angeles. then you can call like: convertDateFromSrcTzToTargetTz(new Date('6 Nov 2022, 00:00'), "America/Los_Angeles", "America/New_York") this function will return 6 Nov 2022, 2:00 because generally NY is 3 hours ahead of LA but at 2:00AM NY will switch to DST and hence it will be not 3:00AM but 2:00AM. */ export declare const convertDateFromSrcTzToTargetTz: (date: Date | number, srcTz?: string, targetTz?: string) => number; /** * @param date Date object or epoch representing the date in particular timezone * @param timezone timezone of the date * @returns epoch of the same time in system timezone * Use case: * Lets say user selects 6 Nov 2022, 00:00 from Time range picker and selects New York timezone. * Now we want to find out what that time represents in our system timezone(Los Angeles) which in given case is 5 Nov 2022, 21:00 */ export declare const convertDateFromTargetTzToSystemTz: (date: Date | number, timezone?: string) => number; /** * @param date date in system timezone * @param timezone timezone in which you want to convert this date to * @returns date in that timezone * Use case: * User will come back with 5 Nov 2022, 21:00 but has selected new york timezone so we want to find out * what time it will be in new york when it is 5 Nov 2022, 21:00 in system timezone(Los Angeles), which is * 6 Nov 2022, 00:00 */ export declare const convertDateFromSystemTzToTargetTz: (date: Date | number, timezone?: string) => number; /** * returns milliseconds offset from timezone name */ export declare const getTzOffset: (timezone: string, date?: number | Date | undefined) => number; /** * @deprecated use convertDateFromTargetTzToSystemTz function to make sure you account for DST cases too * convert epoch from one timezone to another */ export declare const switchEpochTimezone: (date: Date | number, tzFrom?: string, tzTo?: string) => number; /** * Adds or subtract the offset according to timezone passed so that we can get correct start date and end date in that timezone. * ex. Lets say we are in Asia/Kolakata timezone on 19th Feb and time is 12:30 AM, and selected Asia/Kabul timezone and preset as Today. * Now in Asia/Kolkata timezone today implies 19th Feb. But for Asia/Kabul which is one hour behind Asia/Kolkata Today still implies 18th Feb. * So, this function will subtract that offset of 1 hour from current date so new time 11:30PM, with this time we can get correct value * of today, this week, etc preset. */ export declare const getDateForGivenTimezone: (timezone?: string | undefined) => Date; export declare const getDefaultTimeRangePresets: (locale: Locale) => TimeRangePreset[]; export declare const formatSummaryValue: ({ date, presetId, presetLabel, timezone, formatString, showFullDateInSummary, showTimezoneInSummary, adapter, locale, hidePresetLabel, displayVariant, }: FormatSummaryValueOptions) => string; export declare const getRangeError: ({ maxDate, minDate, dateHelpers, timeRange, locale, preset, }: { minDate?: Date | null | undefined; maxDate?: Date | null | undefined; dateHelpers: DateHelpers; timeRange: Date[]; locale: Locale; preset?: string | undefined; }) => { hasError: boolean; errMsg?: string; };