New year, old bugs

Or: Old year, new bugs

Or: Bug of the week number

Or: It is the first week of 2009, but it is still 2008

We all know that date calculation is tricky. Don’t get me started on time zones! I’ve found a web-based time report application and an online movie rental site that fails to handle a wonderful corner case taking place right now, in the last days of year 2008.

Week numbers are used very often in Sweden, and of course they need calculation too. There is fortunately an ISO standard (mandatory Wikipedia link) that defines week 1 to be the the week with the year’s first Thursday in it. This is also the first week with four or more days in the new year.

This week is obviously week 1 by the above definition, as the first of January is on Thursday (tomorrow). There is also no denying that it we are still in the year 2008. (At least in Europe. Damn time zones!)

Let’s look at a time report application that might as well remain anonymous. By default it shows the current week, except for Monday-Wednesday this week:

(You guessed right: the Swedish word for “week” is “vecka”)

If I press the left arrow to move to the previous week, I get a time report page for week 52, year 2007. The right arrows takes me to the time report page for week 2, 2008. Oups!

An unnamed Swedish movie rental site shows the “New movies in December 2008” with “New this week”, but looking at the actual dates I’m pretty sure that people have been able to rent these movies for a whole year!

I should have started looking for more bugs like this already on Monday, because tomorrow I expect these bugs to be hidden and they will not show again for a few years! In about a year I might look for similar bugs appearing the days when it is the last week of 2009 but the year is 2010.

Happy new year!

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.