As You Were

Devin Coughlin's blog.
Styles: Serious Spare

October 31, 2006

Falling Back

I started in on some code today that I hadn't touched since last week, only to have a bunch of previously passing unit tests fail. Yeah, it was a daylight saving bug. Not in the code itself, which was designed to work with such things, but in the tests. I was, for no good reason, converting dates to strings and then comparing those with expected strings. But the string conversion depends on the number of seconds from the meridien, which changed (at least for me) this weekend. Doh. Much better to compare dates explicitly.

There's a lesson in there, somewhere. (Maybe it's to avoid date and calendar programming).

Posted by coughlin at 5:17 PM