Midnight is where these usually break
A shift from 22:00 to 06:00 is eight hours, but naive subtraction gives minus sixteen. Any tool that returns a negative number for a night shift is doing plain arithmetic on clock values without noticing the day changed.
This one detects that the end time is earlier than the start and rolls forward a day, which is what a person means by that pair of times.





