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.
553 B ยท 18 lines
TypeScript
at main
12345678910111213141516171819import type { MaintenanceUpdate } from "../types";
/** Newest entry by date, then id; the public `message` of a maintenance. */export function latestMaintenanceUpdate< T extends Pick<MaintenanceUpdate, "date" | "id">,>(updates: ReadonlyArray<T>): T | undefined { let latest: T | undefined; for (const update of updates) { if ( !latest || update.date.getTime() > latest.date.getTime() || (update.date.getTime() === latest.date.getTime() && update.id > latest.id) ) { latest = update; } } return latest;}