Working with legacy code can present some, um, interesting challenges. I just hit a wonderful issue to do with dates and timezones, caused by a really piss-poor data model.
The code I was looking at was comparing two maps, both keyed by date. The problem was that the system was never designed for international use, so while one map (the one coming in from the UI) was correctly mapped to the right time zone, the other (from the server) wasn’t. So, naturally, the code didn’t think that the two collections had anything in common. Ouch.
What makes it really bad is that, apparently, the data model (part of the legacy, and not amenable to change at the moment) understands about time zones. That is, it “understands” that each country has one. And only one. Considering that just in Australia, we have three (four if you include the Daylight Savings Time split), this isn’t really understandable at all.