One great feature of the Loop app (https://github.com/iSoron/uhabitsfor) is the "late sleeper mode".
Habits validated between midnight and 2-3 in the morning are considered part of the previous day and not the current day.
It's particularly useful for habits you do before going to sleep.
Thanks !