1export function resetDay(date: Date): number { 2 let day = date.getDate(); 3 // if date is within 8 hours of the upcoming midnight in UTC, add 1 to day. 4 // This is to make sure a statement still gets cut after making the change. 5 const hours = date.getUTCHours(); 6 if (hours >= 16) { 7 day += 1; 8 } 9 if (day > 28) { 10 return 1; 11 } 12 return day; 13} 14 15