Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
TypeScript
12345678910export function calculatePeriod(from: Date | undefined, _to: Date | undefined) { const today = new Date(); const diffTime = Math.abs(today.getTime() - (from?.getTime() ?? 0)); const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24)); if (diffDays <= 1) return "1d"; if (diffDays <= 7) return "7d"; if (diffDays <= 14) return "14d"; return "14d";}