Incident history
Every incident update and planned maintenance we’ve posted, by month.
import Head from 'next/head' import { useEffect, useState } from 'react' import { MaintenanceConfig, MonitorTarget } from '@/types/config' import { maintenances as configMaintenances, pageConfig } from '@/uptime.config' import Header from '@/components/Header' import Footer from '@/components/Footer' import Notice from '@/components/Notice' import { EmptyState } from '@/components/brand' export const runtime = 'experimental-edge' const monthKey = (d: Date) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}` function selectedMonth() { const hash = window.location.hash.replace('#', '') return /^\d{4}-\d{2}$/.test(hash) ? hash : monthKey(new Date()) } function shift(month: string, by: number) { const [y, m] = month.split('-').map(Number) return monthKey(new Date(y, m - 1 + by)) } function monthName(month: string) { const [y, m] = month.split('-').map(Number) return new Date(y, m - 1).toLocaleDateString(undefined, { month: 'long', year: 'numeric' }) } export default function Incidents({ monitors, maintenances, }: { monitors: MonitorTarget[] maintenances: MaintenanceConfig[] }) { const [month, setMonth] = useState(selectedMonth) const [service, setService] = useState('') useEffect(() => { const onHash = () => setMonth(selectedMonth()) window.addEventListener('hashchange', onHash) return () => window.removeEventListener('hashchange', onHash) }, []) const list = maintenances .filter((n) => monthKey(new Date(n.start)) === month) .filter((n) => !service || n.monitors?.includes(service)) .sort((a, b) => +new Date(b.start) - +new Date(a.start)) const isCurrentMonth = month === monthKey(new Date()) return ( <>
Every incident update and planned maintenance we’ve posted, by month.