I created a scoreboard objective tied with time_since_rest stat to reset the insomnia timer but when i reset it to 0 phantoms are still spawning. It may effect earlier versions as I have only just stumbled across it
Recreation:
1. Create world
2. Run /scoreboard objectives add rest minecraft.custom:minecraft.time_since_rest
3. Let the world run until phantoms start spawning
4. Run /kill @e[type=phantom]
5. Run scoreboard players reset @a rest
Wait till night if its not night all ready and you will see that after 1 or 2 minutes phantoms still spawn even with the time_since_rest is well below 72000
The scoreboard value != the statistic value; it's a trigger, it triggers to increase the same time the stat increases.