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

Function getDefaultIntervalByDates

packages/constants/index.ts:321–340  ·  view source on GitHub ↗
(
  startDate: string | null,
  endDate: string | null
)

Source from the content-addressed store, hash-verified

319}
320
321export function getDefaultIntervalByDates(
322 startDate: string | null,
323 endDate: string | null
324): null | keyof typeof intervals {
325 if (startDate && endDate) {
326 if (isSameDay(startDate, endDate)) {
327 return 'hour';
328 }
329 const days = differenceInDays(endDate, startDate);
330 if (days <= 92) {
331 return 'day';
332 }
333 if (days <= 186) {
334 return 'week';
335 }
336 return 'month';
337 }
338
339 return null;
340}
341
342export const countries = {
343 AF: 'Afghanistan',

Callers 5

getMetricsFunction · 0.90
TimeWindowPickerFunction · 0.90
reportSlice.tsFile · 0.90
useOverviewOptionsFunction · 0.90
DateRangerPickerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected