- There are months with 31 days.
- We actually have daylight saving time.
- It’s cold in the winter.
One: The first phenomenon was discovered in the end of August when suddenly the forecasts for September 1st shown on the site was dated as October 1st. It took a while before we realized what happened. The code for setting the date looked something like this:
var forecastDay = new Date(2010,7,31);
Tue Aug 31 2010 00:00:00 GMT+0200 (CEST)
Fri Oct 01 2010 00:00:00 GMT+0200 (CEST)
Since August have 31 days but September only 30 the 31st day of September really is October 1st. So when we set the day after setting the month we are suddenly in October. The easy fix? To set the day of month before setting the month. The correct fix? To set year, month, and date in the same method call.
Three: When the Flash rendering of the ten-day forecast suddenly went blank for some places up north last week we had a number of theories on the cause. Once again the weather service was a prime suspect but the data was in order so we began to think that it was something different with the data that the Flash code couldn’t handle. And sure enough, it turns out that the code rendering the curve of temperatures didn’t work when all temperatures in the forthcoming ten days were in the sub-zeros (Celsius degrees that is).