MCPcopy
hub / github.com/umami-software/umami / getCompareDate

Function getCompareDate

src/lib/date.ts:316–328  ·  view source on GitHub ↗
(compare: string, startDate: Date, endDate: Date)

Source from the content-addressed store, hash-verified

314}
315
316export function getCompareDate(compare: string, startDate: Date, endDate: Date) {
317 if (compare === 'yoy') {
318 return { compare, startDate: subYears(startDate, 1), endDate: subYears(endDate, 1) };
319 }
320
321 if (compare === 'prev') {
322 const diff = differenceInMinutes(endDate, startDate);
323
324 return { compare, startDate: subMinutes(startDate, diff), endDate: subMinutes(endDate, diff) };
325 }
326
327 return {};
328}
329
330export function getDayOfWeekAsDate(dayOfWeek: number) {
331 const startOfWeekDay = startOfWeek(new Date());

Callers 6

useDateRangeFunction · 0.90
GETFunction · 0.90
GETFunction · 0.90
GETFunction · 0.90
GETFunction · 0.90
POSTFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected