Home » Date and Time » Date » Bug #674
strange (wrong?) result of Date_Calc::endOfWeek
Details
| Submitted | 2004-02-03 14:26 UTC |
|---|---|
| From | lucas dot ackermann at foeg dot unizh dot ch |
| Assigned | pajoye |
| Status | Closed |
| Package | Date |
| PHP Version | 4.3.2 |
| OS | Win2000 |
| 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