get-minutes-elapsed-since-midnight.ts
export function getMinutesElapsedSinceMidnight() {
  // Get the current date
  const currentDate = new Date();
  // Create a date from that, but 0 out the hours, minutes, seconds, and milliseconds (aka midnight)
  const currentDateAsMidnight = new Date(
    currentDate.getFullYear(),
    currentDate.getMonth(),
    currentDate.getDate(),
  );

  // Get the milliseconds elapsed since midnight
  const msElapsedSinceMidnight = currentDate.getTime() - currentDateAsMidnight.getTime();

  // Convert the milliseconds to minutes
  const minutesElapsedSinceMidnight = Math.floor(
    msElapsedSinceMidnight / 1000 / 60,
  );

  return minutesElapsedSinceMidnight;
}