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.
962 B ยท 32 lines
TypeScript
123456789101112131415161718192021222324252627282930313233export function endOfDay(date: Date): Date { // Create a new Date object to avoid mutating the original date // const newDate = new Date(date); const newDate = new Date( Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()), );
// Set hours, minutes, seconds, and milliseconds to end of day newDate.setUTCHours(23, 59, 59, 999);
return newDate;}
export function startOfDay(date: Date): Date { // Create a new Date object to avoid mutating the original date // const newDate = new Date(date); const newDate = new Date( Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()), );
// Set hours, minutes, seconds, and milliseconds to start of day newDate.setUTCHours(0, 0, 0, 0);
return newDate;}
export function isSameDay(date1: Date, date2: Date) { const newDate1 = startOfDay(date1); const newDate2 = startOfDay(date2);
return newDate1.toUTCString() === newDate2.toUTCString();}