Skip to content

Commit 2d68100

Browse files
committed
remove new func
1 parent 2f0d2da commit 2d68100

File tree

1 file changed

+0
-51
lines changed
  • packages/cubejs-client-core/src

1 file changed

+0
-51
lines changed

packages/cubejs-client-core/src/time.ts

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -255,57 +255,6 @@ export const timeSeriesFromCustomInterval = (from: string, to: string, granulari
255255
return dates;
256256
};
257257

258-
/**
259-
* Returns the date range for a specific granularity bucket containing the given value.
260-
* Handles both predefined granularities (day, week, month, etc.) and custom granularities.
261-
*
262-
* @param value - The date/time value to find the bucket for
263-
* @param granularity - The granularity name (predefined or custom)
264-
* @param granularityAnnotation - Optional annotation containing custom granularity metadata (interval, origin, offset)
265-
* @returns Object with start and end dayjs instances representing the granularity bucket
266-
*/
267-
export const getGranularityDateRange = (
268-
value: any,
269-
granularity: string,
270-
granularityAnnotation?: { granularity?: Granularity },
271-
allAnnotations?: Record<string, { granularity?: Granularity }>
272-
): { start: dayjs.Dayjs; end: dayjs.Dayjs } => {
273-
if (isPredefinedGranularity(granularity)) {
274-
// Use existing dayRange.snapTo logic for predefined granularities
275-
const range = dayRange(value, value, allAnnotations).snapTo(granularity);
276-
return {
277-
start: range.start,
278-
end: range.end
279-
};
280-
}
281-
282-
// Handle custom granularities
283-
const customGranularity = granularityAnnotation?.granularity;
284-
285-
if (customGranularity && customGranularity.interval) {
286-
// Parse the interval (e.g., "5 minutes")
287-
const intervalParsed = parseSqlInterval(customGranularity.interval);
288-
289-
// The value is the start of the interval bucket
290-
const intervalStart = internalDayjs(value);
291-
292-
// Calculate the end of the interval bucket
293-
// End is start + interval - 1 millisecond
294-
const intervalEnd = addInterval(intervalStart, intervalParsed).subtract(1, 'millisecond');
295-
296-
return {
297-
start: intervalStart,
298-
end: intervalEnd
299-
};
300-
}
301-
302-
// Fallback to point-in-time if no custom granularity metadata found
303-
return {
304-
start: internalDayjs(value),
305-
end: internalDayjs(value)
306-
};
307-
};
308-
309258
/**
310259
* Returns the lowest time unit for the interval
311260
*/

0 commit comments

Comments
 (0)