Monday morning. I’ve just arrived at the office, and I see my first task to do: **fix a bug in a calendar** from one of our websites. Actually there are 2 calendars, and one calculation to show the difference in days between the two dates. Somebody discovered a weird behaviour when you select a range of days in the end of March… the difference of days is not an integer number, but a float one!

I isolated the problem, shortening the range of days, until I discovered that the problem is in the last weekend of March. **From Friday 23rd to Monday 26th of March, there are 2.95 days** (instead of just 3 days). What’s happening that weekend? **Why is the last weekend of March somehow weird?** Any idea?

*If you want to know the solution, see the first comment of this post. Tip: I use a PHP function to convert the dates into integer timestamps (seconds), I substract these integers, and finally I divide by 3600*24, to know the difference in days.*

During the night of the last Saturday-Sunday of March, a Daylight savings shift happens.

So, Sunday 25th only has 23hours, and this is the reason to have a “0.95 day”.

I got it 😉