bug in get_calendar() or I have a pretty freaky php install
-
Hi,
I have a bug (I think) in the get_calendar() function. Or maybe it is calendar_week_mod()For certain months, those starting on a monday like June 2009, the weekday calculation that adds the padding gets it all wrong. It adds 6 days of padding instead of 0. Like so:
<td colspan="6" class="pad"> </td><td>1</td><td>2</td><td>3</td><td><a href="https://www.eimermusic.com/2009/06/04/" title="StarSchema (OLAP) setup for reporting in CakePHP">4</a></td><td>5</td><td>6</td><td>7</td>
The padding calculation ends up like this:
$pad = calendar_week_mod(date('w', $unixmonth)-$week_begins); // == 6
translates to:
6 = calendar_week_mod(0-1);
That is: calendar_week_mod() gets a negative number whenever a month stars on a Sunday and the setting for the blog has a week_begins other than Sunday. I tried switching to the week starting on Tuesday and then I get even more strangeness.
- The topic ‘bug in get_calendar() or I have a pretty freaky php install’ is closed to new replies.