Add unit tests for the time of day math category, fix edge cases