PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Date and Time » Date » Bug #674

strange (wrong?) result of Date_Calc::endOfWeek

Details

Submitted2004-02-03 14:26 UTC
Fromlucas dot ackermann at foeg dot unizh dot ch
Assignedpajoye
StatusClosed
PackageDate
PHP Version4.3.2
OSWin2000
Roadmaps(Not assigned)

Comments

[2004-02-03 14:26 UTC] lucas dot ackermann at foeg dot unizh dot ch

Description:
------------
The call of Date_Calc::endOfWeek with a sunday as parameter gives the _next_ Sunday.
I would expect the same sunday as Result.

Reproduce code:
---------------
Date_Calc::endOfWeek(8,2,2004)

Expected result:
----------------
20040208

With the following modification of the function I get the expected result:

function endOfWeek [...]
{
[...]
$this_weekday = Date_Calc::dayOfWeek [...]

if ($this_weekday == 0) {
$this_weekday = 7;
}

$last_dayOfWeek = (Date_Calc::dateToDays [...]
[...]
return [...]
}

Actual result:
--------------
20040215