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] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!