Home » Date and Time » Calendar » Bug #5749
Current year is actually last year
Details
| Submitted | 2005-10-21 23:22 UTC |
|---|---|
| From | dyohi at yahoo dot com |
| Assigned | quipo |
| Status | Bogus |
| Package | Calendar |
| PHP Version | 4.3.11 |
| OS | Windows |
| Roadmaps | (Not assigned) |
Comments
[2005-10-21 23:22 UTC] dyohi at yahoo dot com
Description:
------------
As you can see, although the month and year are displayed properly, the days are for the previous year's month.
If you compare these three month's with a calendar for 2005 you'll see that the day position is off by one day.
September 2005
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30
October 2005
Su Mo Tu We Th Fr Sa
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
November 2005
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Test script:
---------------
function DisplayMonth($y, $m){
$Month = new Calendar_Month_Weekdays($y, $m);
$Month->build();
echo "<table bgcolor=black border=0 cellspacing=0 cellpadding=1>\n";
echo "<tr>";
echo "<td colspan=7 bgcolor=white align=center style='font-family: arial; font-size: 8pt'><b>".date("F Y", mktime(0,0,0,$Month->thisMonth(),1,$Month->thisYear()))."</b></td>";
echo "</tr>";
echo "<tr>";
echo "<td bgcolor=white align=center style='font-family: arial; font-size: 8pt'><b>Su</b></td>";
echo "<td bgcolor=white align=center style='font-family: arial; font-size: 8pt'><b>Mo</b></td>";
echo "<td bgcolor=white align=center style='font-family: arial; font-size: 8pt'><b>Tu</b></td>";
echo "<td bgcolor=white align=center style='font-family: arial; font-size: 8pt'><b>We</b></td>";
echo "<td bgcolor=white align=center style='font-family: arial; font-size: 8pt'><b>Th</b></td>";
echo "<td bgcolor=white align=center style='font-family: arial; font-size: 8pt'><b>Fr</b></td>";
echo "<td bgcolor=white align=center style='font-family: arial; font-size: 8pt'><b>Sa</b></td>";
echo "</tr>";
while ($Day = $Month->fetch()) {
if ($Day->isFirst()) {
echo "<tr>\n";
}
if ($Day->isEmpty()) {
echo "<td bgcolor=white> </td>\n";
} else {
if(date('n/j/Y') == "$m/".$Day->thisDay()."/$y")
echo "<td bgcolor=yellow align=center style='font-family: arial; font-size: 8pt'><b>".$Day->thisDay()."</b></td>\n";
else
echo "<td bgcolor=white align=center style='font-family: arial; font-size: 8pt'>".$Day->thisDay()."</td>\n";
}
if ($Day->isLast()) {
echo "</tr>\n";
}
}
echo "</table>\n";
}
?>
Expected result:
----------------
See description.
Actual result:
--------------
See description.