revise the cross-midnight logic for ToD rules

We must derive the last midnight that occured to determine whether to move the end a day forward or the start a day behind.

also changes the final time-range check to use NSDate's comparison function so that the actual date is taken into account in addition to hour & minute.