The solution you currently have would assume the day's half is at 12:00.
With that assumption in mind you could also take the diff in hours and apply modulo 24 over them (120%24 -> 12).
If the value resulted is exactly 12 than you can consider it half day, but by using this you will only allow splitting the day in to halves.
I'd recommend using a different mechanism for the hours off.
Calculate the full days + compute the working hours that you want to take off afterwards.