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

Function previousPeriod

apps/api/src/agents/tools/helpers.ts:236–244  ·  view source on GitHub ↗
(startDate: string, endDate: string)

Source from the content-addressed store, hash-verified

234 * Compute the immediately-preceding period given a (start, end) range.
235 */
236export function previousPeriod(startDate: string, endDate: string) {
237 const start = new Date(startDate).getTime();
238 const end = new Date(endDate).getTime();
239 const span = end - start;
240 return {
241 startDate: new Date(start - span - 86_400_000).toISOString().slice(0, 10),
242 endDate: new Date(start - 86_400_000).toISOString().slice(0, 10),
243 };
244}
245
246/**
247 * Build a clickable dashboard URL for a tool result.

Callers 2

report.tsFile · 0.90
pages.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected