UNPKG

1.54 kBTypeScriptView Raw
1export type TimeTransform = (d: Date, ...rest: any[]) => Date;
2type TimeRange = (start: Date, stop: Date, step: number, shouldAdjust?: boolean) => Date[];
3type TimeProcess = (d: Date, ...rest: any[]) => void;
4type TimeField = (d: Date) => number;
5export declare const DURATION_SECOND = 1000;
6export declare const DURATION_MINUTE: number;
7export declare const DURATION_HOUR: number;
8export declare const DURATION_DAY: number;
9export declare const DURATION_WEEK: number;
10export declare const DURATION_MONTH: number;
11export declare const DURATION_YEAR: number;
12export type Interval = {
13 floor: TimeTransform;
14 ceil: TimeTransform;
15 range: TimeRange;
16 duration: number;
17};
18export type IntervalMap = {
19 millisecond: Interval;
20 second: Interval;
21 minute: Interval;
22 hour: Interval;
23 day: Interval;
24 week: Interval;
25 month: Interval;
26 year: Interval;
27};
28export declare function createInterval(duration: number, floorish: TimeProcess, offseti: TimeProcess, field?: TimeField): {
29 ceil: TimeTransform;
30 floor: TimeTransform;
31 range: (start: Date, stop: Date, step: number, shouldAdjust?: boolean) => any[];
32 duration: number;
33};
34export declare const millisecond: Interval;
35export declare const second: Interval;
36export declare const minute: Interval;
37export declare const hour: Interval;
38export declare const day: Interval;
39export declare const month: Interval;
40export declare const week: Interval;
41export declare const year: Interval;
42export declare const localIntervalMap: IntervalMap;
43export {};