UNPKG

@quanxi/ui

Version:

全悉组件库

32 lines (31 loc) 1.2 kB
import dayjs, { ManipulateType } from "dayjs"; import { DurationUnitType } from "./constant"; import { DateOptionsType, DateFormatType } from "./type"; export declare const getValueAndUnitFromIsoDurationStr: (durationISOString: string) => { value: number; unit: DurationUnitType; }; export declare const getPresetDateRange: (value: string, customDateOptions?: DateOptionsType[]) => { start: number | undefined; end: number | undefined; }; export declare const getTimeRange: (value: number, unit: ManipulateType) => { start: number; end: number; }; export declare function resolveTimeRange(v: string | undefined | null): { type: string; timestamp: { start: number | undefined; end: number | undefined; }; value: string; }; /** * 根据时间颗粒度调整时间 * @param time 时间戳或Dayjs对象 * @param dateFormat 时间颗粒度: "hour" * @param isEndTime 是否为结束时间,结束时间设置为当前颗粒度的结束时间 * @returns 调整后的时间戳 */ export declare const adjustTimeByFormat: (time: number | dayjs.Dayjs | undefined, dateFormat: DateFormatType, isQuickSelectTime?: boolean) => number | undefined;