import type { unitOfTime } from 'moment-timezone'; import type { DateRange } from 'moment-range'; export type QueryDateRange = [string, string]; type SqlInterval = string; export type TimeSeriesOptions = { timestampPrecision: number; }; type ParsedInterval = Partial>; export declare const pad2: (n: number) => string; export declare const pad3: (n: number) => string; export declare const pad4: (n: number) => string; export type DimensionToCompareGranularity = { dimension: string; expressionName?: string; granularityObj?: { minGranularity(): string; }; }; /** * Actually dimensions type is (BaseDimension|BaseTimeDimension)[], but can not ref due to cyclic dependencies refs. */ export declare function findMinGranularityDimension(id: string, dimensions: DimensionToCompareGranularity[]): { index: number; dimension: DimensionToCompareGranularity | undefined; } | null; export declare const TIME_SERIES: Record QueryDateRange[]>; /** * Parse PostgreSQL-like interval string into object * E.g. '2 years 15 months 100 weeks 99 hours 15 seconds' * Negative units are also supported * E.g. '-2 months 5 days -10 hours' */ export declare function parseSqlInterval(intervalStr: SqlInterval): ParsedInterval; /** * SQL interval units, coarsest first. */ export declare const SQL_INTERVAL_UNITS: unitOfTime.DurationConstructor[]; /** * Splits an interval into one single-unit interval string per component, coarsest first. * Units outside SQL_INTERVAL_UNITS are kept, so a caller that can not render one still sees it. */ export declare function splitSqlInterval(intervalStr: SqlInterval): string[]; export declare function addInterval(date: moment.Moment, interval: ParsedInterval): moment.Moment; export declare function subtractInterval(date: moment.Moment, interval: ParsedInterval): moment.Moment; /** * Returns the closest date prior to date parameter aligned with the origin point */ export declare const alignToOrigin: (startDate: moment.Moment, interval: ParsedInterval, origin: moment.Moment) => moment.Moment; export declare const parsedSqlIntervalToDuration: (parsedInterval: ParsedInterval) => moment.Duration; export declare const timeSeriesFromCustomInterval: (intervalStr: string, [startStr, endStr]: QueryDateRange, origin: moment.Moment, options?: TimeSeriesOptions) => QueryDateRange[]; /** * Returns array of date ranges for a predefined granularity aligned with the start of the year as pivot point */ export declare const timeSeries: (granularity: string, dateRange: QueryDateRange, options?: TimeSeriesOptions) => QueryDateRange[]; /** * Returns the first and last ranges of timeSeries() without materializing the ones in between. * The input range is still validated against the same partition count limit. */ export declare const timeSeriesBoundaries: (granularity: string, dateRange: QueryDateRange, options?: TimeSeriesOptions) => [QueryDateRange | undefined, QueryDateRange | undefined]; export declare const isPredefinedGranularity: (granularity: string) => boolean; export declare const FROM_PARTITION_RANGE = "__FROM_PARTITION_RANGE"; export declare const TO_PARTITION_RANGE = "__TO_PARTITION_RANGE"; export declare const BUILD_RANGE_START_LOCAL = "__BUILD_RANGE_START_LOCAL"; export declare const BUILD_RANGE_END_LOCAL = "__BUILD_RANGE_END_LOCAL"; /** * Takes timestamp, treat it as time in provided timezone and returns the corresponding timestamp in UTC */ export declare const localTimestampToUtc: (timezone: string, timestampFormat: string, timestamp?: string) => string | null; /** * Takes timestamp in UTC, shift it into provided timezone and returns the corresponding timestamp in UTC */ export declare const utcToLocalTimeZone: (timezone: string, timestampFormat: string, timestamp?: string) => string | null; export declare const parseUtcIntoLocalDate: (data: { [key: string]: string; }[] | null | undefined, timezone: string, timestampFormat?: string) => string | null; export declare const addSecondsToLocalTimestamp: (timestamp: string, timezone: string, seconds: number) => Date; export declare const reformatInIsoLocal: (timestamp: string) => string; export {}; //# sourceMappingURL=time.d.ts.map