Window of opportunity

ChrisDolan on 2007-03-24T01:40:13

I had a bug this week that I could reproduce but a colleague could not. He had written some test code to exercise the start/end dates of a web feature. At my recommendation, he used

DateTime::Format::MySQL->format_date(DateTime->now)
to generate a test date to put into the database, which we would then compare with MySQL's now() function. Unfortunately, I forgot to tell him to add the time_zone => 'local' argument to DateTime->now, so DateTime was using UTC whereas MySQL was correctly using the local timezone, CDT. Consequently, the test passed from midnight to 6pm when he was working but failed from 6pm to midnight when I was working.

D'oh.