Skip to content

Commit 79f515c

Browse files
committed
export some functions from backend-shared/time
1 parent b46262d commit 79f515c

File tree

1 file changed

+4
-4
lines changed
  • packages/cubejs-backend-shared/src

1 file changed

+4
-4
lines changed

packages/cubejs-backend-shared/src/time.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function subtractInterval(date: moment.Moment, interval: ParsedInterval):
7676
/**
7777
* Returns the closest date prior to date parameter aligned with the origin point
7878
*/
79-
function alignToOrigin(startDate: moment.Moment, interval: ParsedInterval, origin: moment.Moment): moment.Moment {
79+
export const alignToOrigin = (startDate: moment.Moment, interval: ParsedInterval, origin: moment.Moment): moment.Moment => {
8080
let alignedDate = startDate.clone();
8181
let intervalOp;
8282
let isIntervalNegative = false;
@@ -111,17 +111,17 @@ function alignToOrigin(startDate: moment.Moment, interval: ParsedInterval, origi
111111
}
112112

113113
return alignedDate;
114-
}
114+
};
115115

116-
function parsedSqlIntervalToDuration(parsedInterval: ParsedInterval): moment.Duration {
116+
export const parsedSqlIntervalToDuration = (parsedInterval: ParsedInterval): moment.Duration => {
117117
const duration = moment.duration();
118118

119119
Object.entries(parsedInterval).forEach(([key, value]) => {
120120
duration.add(value, key as unitOfTime.DurationConstructor);
121121
});
122122

123123
return duration;
124-
}
124+
};
125125

126126
function checkSeriesForDateRange(intervalStr: string, [startStr, endStr]: QueryDateRange): void {
127127
const intervalParsed = parseSqlInterval(intervalStr);

0 commit comments

Comments
 (0)