MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getChartStartEndDate

Function getChartStartEndDate

packages/db/src/services/date.service.ts:248–271  ·  view source on GitHub ↗
(
  {
    startDate,
    endDate,
    range,
  }: Pick<IReportInput, 'endDate' | 'startDate' | 'range'>,
  timezone: string
)

Source from the content-addressed store, hash-verified

246}
247
248export function getChartStartEndDate(
249 {
250 startDate,
251 endDate,
252 range,
253 }: Pick<IReportInput, 'endDate' | 'startDate' | 'range'>,
254 timezone: string
255) {
256 const normalizedStart = startDate
257 ? normalizeBoundary(startDate, 'start')
258 : startDate;
259 const normalizedEnd = endDate ? normalizeBoundary(endDate, 'end') : endDate;
260
261 if (normalizedStart && normalizedEnd) {
262 return { startDate: normalizedStart, endDate: normalizedEnd };
263 }
264
265 const ranges = getDatesFromRange(range, timezone);
266 if (!normalizedStart && normalizedEnd) {
267 return { startDate: ranges.startDate, endDate: normalizedEnd };
268 }
269
270 return ranges;
271}
272
273export function getChartPrevStartEndDate({
274 startDate,

Callers 14

runReportFunction · 0.90
normalizeFunction · 0.90
getReportDataCoreFunction · 0.90
resolveDatesFunction · 0.90
getCurrentAndPreviousFunction · 0.90
overview.tsFile · 0.90
reference.tsFile · 0.90
chart.tsFile · 0.90
event.tsFile · 0.90
resolveDatesFunction · 0.90
getMetricsFunction · 0.90
getPagesFunction · 0.90

Calls 2

normalizeBoundaryFunction · 0.85
getDatesFromRangeFunction · 0.85

Tested by

no test coverage detected