Home » Date and Time » Calendar » Bug #2416
Documentation Error
Details
| Submitted | 2004-09-30 09:03 UTC |
|---|---|
| From | chris at deskpro dot com |
| Assigned | quipo |
| Status | Closed |
| Package | Calendar |
| PHP Version | 4.3.4 |
| OS | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2004-09-30 09:03 UTC] chris at deskpro dot com
Description:
------------
In documentation, found here.
This is wrong:
<?php
$Month = new Calendar_Month(2003, 10);
$Month->build();
$i = 1;
while ($Day = $Month->fetch()) {
echo $Day->thisDay()."<br />\n";
$i++;
}
echo $i; // Displays 31 (31 days in October)
?>
It actually displays 32 at the end because $i, is increased again after the last day. Either remove the last echo $i, or start with $i=0 and have the $i++; above the first echo.
Found here:
http://pear.php.net/manual/en/package.datetime.calendar.intro-overview-methods.php
[2004-09-30 09:36 UTC] chris at deskpro dot com
Another one:
http://pear.php.net/manual/en/package.datetime.calendar.intro-decorators.php
The simple usage for uri decorator, the example is wrong. It looks like this:
<?php
$Day = new Calendar_Day(2003, 10, 23);
$Uri = & new Calendar_Decorator_Uri($Day);
$Uri->setFragments('year', 'month', 'day');
echo $Uri->getPrev();
// Displays year=2003&month=10&day=22
?>
but it should be somethig like:
<?php
$Day = new Calendar_Day(2003, 10, 23);
$Uri = & new Calendar_Decorator_Uri($Day);
$Uri->setFragments('year', 'month', 'day');
echo $Uri->Prev('day');
// Displays year=2003&month=10&day=22
?>
It is Prev() not getPrev() and you need to specify 'day', day is not defined as a default in the function.