Building the time window
CalendarApp.getEvents(start, end) takes two Date objects. The interval is half-open: start is inclusive, end is exclusive. That means if you pass midnight-tonight as end, any event that starts exactly at midnight tonight is excluded, which is what you want. Where people trip up is setting end to the same value as start, or to the current time instead of midnight, and then wondering why the afternoon is missing.
The safe pattern is to zero out start with setHours(0, 0, 0, 0) — that resets hours, minutes, seconds, and milliseconds to zero — then copy that date and advance one calendar day with setDate(getDate() + 1). You end up with today-at-00:00:00.000 to tomorrow-at-00:00:00.000, which covers the full day.
I keep this date-building block in a small utils file because I reuse it in digest scripts, billing summaries, and daily standup bots. Writing it inline each time invites the copy-paste drift where someone adjusts one variable but not the other.