()
| 43 | }; |
| 44 | |
| 45 | const scheduleNextMidnightCheck = (): number => { |
| 46 | const msUntilMidnight = getMillisecondsUntilNextLocalMidnight(getNow()); |
| 47 | |
| 48 | if (midnightTimeout !== null) { |
| 49 | timer.clearTimeout(midnightTimeout); |
| 50 | } |
| 51 | |
| 52 | midnightTimeout = timer.setTimeout(() => { |
| 53 | checkDateChange(); |
| 54 | scheduleNextMidnightCheck(); |
| 55 | }, msUntilMidnight); |
| 56 | |
| 57 | registerTimer(midnightTimeout); |
| 58 | return midnightTimeout; |
| 59 | }; |
| 60 | |
| 61 | const intervalId = timer.setInterval(checkDateChange, intervalMs); |
| 62 | registerTimer(intervalId); |
no test coverage detected