* matching JavaScript's default behavior.
*/
function buildLocalDate(year: number, monthIndex: number, day: number, hour: number, minute: number): Date {
schedule.ts
const candidate = new Date(year, monthIndex, day, hour, minute, 0, 0);
if (candidate.getHours() === hour && candidate.getMinutes() === minute) {
return candidate;
}
for (let shift = 1; shift <= 3; shift++) {
const shifted = new Date(year, monthIndex, day, hour + shift, minute, 0, 0);