The New Calendar / Daylight Saving Time Issues.

July 15, 2003, 11:07 am

You've probably noticed that I have this nifty “entry calendar.” JB added a function, GetMonthView() to Enterport. You provide it an optional timestamp of the month to show, an optional name of a callback function, and an optional base link (for the Previous/Next Month links).

I've made a bunch of bugfixes and standards compliance improvements. It's awesome. I really like the way it works. And I've added it to the default /core/news.php and /core/article.php pages.

But we ran into some very weird issues, namely with Daylight Saving Time (DST). In the months of April and October, when we add or subtract an hour, the timestamp passed to the callback function (which expects a day's timestamp set at midnight) will either have 1:00 AM or 11:00 PM of the previous day!

You can't iterate over a group of days by just += 86400 (the number of seconds in one non-DST-changing day ) a timestamp if those days cross over a daylight saving time change. Instead, I changed the function so that it will make a new timestamp with just the day incremented. This fixed the problem and produced expected results.

And by the way, it's “daylight saving time” not savings.