#24324 [Opn->Bgs]: PEAR :: Date :: getWeeksInMonth () -- Ocassionally Wrong

From: Date: Wed, 25 Jun 2003 19:20:42 +0000
Subject: #24324 [Opn->Bgs]: PEAR :: Date :: getWeeksInMonth () -- Ocassionally Wrong
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17723@lists.php.net to get a copy of this message
ID: 24324 User updated by: cricket at djcricket dot com Reported By: cricket at djcricket dot com -Status: Open +Status: Bogus Bug Type: PEAR related Operating System: FreeBSD 4.8-STABLE PHP Version: 4.3.2 New Comment: This is the expected behavior. I did not realize that Monday was used by the class as the beginning of a week. Sorry about the bogus bug =-/ Previous Comments: ------------------------------------------------------------------------ [2003-06-24 21:03:24] cricket at djcricket dot com Description: ------------ When Using the getWeeksInMonth() method of the PEAR::Date class, ocassionally the calculation is wrong. The following code shows that July/2003 returns 6 weeks in the month, instead of 5. This error was duplicated with the same code on a RedHat 7.3 box as well. Reproduce code: --------------- require_once 'Date.php'; $date = new Date ( mktime ( 0 , 0 , 0 , 6 , 1 , 2003 ) ); echo "Date: " . $date->getDate () . "<br>\nWeeks In Month: " . $date->getWeeksInMonth (); Expected result: ---------------- Date: 2003-06-01 00:00:00 Weeks In Month: 5 Actual result: -------------- Date: 2003-06-01 00:00:00 Weeks In Month: 6 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24324&edit=1

« previous php.pear.dev (#17723) next »