Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.5.5

Bug #1995 thisWeek, prevWeek, nextWeek not affected when set new timestamp
Submitted: 2004-07-27 13:42 UTC
From: johnschaefer at gmx dot de Assigned: quipo
Status: Closed Package: Calendar
PHP Version: Irrelevant OS: Windows 2000 SP4
Roadmaps: (Not assigned)    
Subscription  


 [2004-07-27 13:42 UTC] johnschaefer at gmx dot de
Description: ------------ if you set a timestamp the variable for thisWeek, prevWeek and nextWeek will not updated. workaround: add the following function to the Calendar_Week class function setTimestamp($ts) { parent::setTimestamp($ts); $this->thisWeek = $this->tableHelper->getWeekStart($this->year, $this->month, $this->day, $this->firstDay); $this->prevWeek = $this->tableHelper->getWeekStart($this->year, $this->month, $this->day - $this->cE->getDaysInWeek(), $this->firstDay); $this->nextWeek = $this->tableHelper->getWeekStart($this->year, $this->month, $this->day + $this->cE->getDaysInWeek(), $this->firstDay); } Reproduce code: --------------- $week = new Calendar_Week(2000, 1, 1); $week->setTimestamp(time()); $week->build(); echo date('W Y', $week->thisWeek(true)); // prints "51 1999", expected the current week number echo "<br>\n"; echo date('W Y', $week->nextWeek(true)); // prints "52 2000", expected the next week number echo "<br>\n"; echo date('W Y', $week->prevWeek(true)); // prints "50 1999", expected the last week number

Comments

 [2004-07-28 09:45 UTC] quipo
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. -- works perfectly, many thanks. Committed to CVS.