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

Function resolveDateRange

packages/db/src/services/date.service.ts:4–13  ·  view source on GitHub ↗
(
  startDate?: string,
  endDate?: string
)

Source from the content-addressed store, hash-verified

2import type { IChartRange, IReportInput } from '@openpanel/validation';
3
4export function resolveDateRange(
5 startDate?: string,
6 endDate?: string
7): { startDate: string; endDate: string } {
8 const end = endDate ?? new Date().toISOString().slice(0, 10);
9 const start =
10 startDate ??
11 new Date(Date.now() - 30 * 86_400_000).toISOString().slice(0, 10);
12 return { startDate: start, endDate: end };
13}
14
15export function getDatesFromRange(range: IChartRange, timezone: string) {
16 if (range === '30min' || range === 'lastHour') {

Callers 3

querySessionsCoreFunction · 0.90
queryEventsCoreFunction · 0.90
resolveDatesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected