Totally by coincidence, this failed when run at midnight, as one DateTime was created at one day and the next was created just milliseconds later at the following day. Fixing it to a date should never cause any issues again.