About PEAR::Date_Calc::weekOfYear() : code and documentation discrepancy

From: Date: Thu, 03 Jan 2008 10:53:20 +0000
Subject: About PEAR::Date_Calc::weekOfYear() : code and documentation discrepancy
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-28387@lists.php.net to get a copy of this message
Hi, In the doc of PEAR::Date_Calc::weekOfYear(), I read: http://pear.php.net/package/Date/docs/1.4.7/apidoc/Date/Date_Calc.html#methodweekOfYear weekOfYear [line 808] int weekOfYear( [int $day = 0], [int $month = 0], [int $year = 0]) Returns week of the year, first Sunday is first day of first week But in the code I see: http://pear.php.net/package/Date/docs/1.4.7/__filesource/fsource_Date__Date-1.4.7DateCalc.php.html#a808 $iso = Date_Calc::gregorianToISO($day, $month, $year); $parts = explode('-', $iso); $week_number = intval($parts[1]); The format generated by gregorianToISO is ISO-8601, and ISO 8601 uses: - Monday as first day of the week. - "Week 01 of the year is the week containing the first Thursday" Am I right to think that code and doc doesn't agree? Please please please: if you fix anything fix the doc, not the code! Returning an ISO normalized value is far more valuable than the fancy definition mentioned in the doc! For example, the ISO code used now is an exact match for MYSQL WEEKOFYEAR() function. Thanks, Yannick -- _/ Yannick Patois \___________________________________________________ | web: http://feelingsurfer.net/garp/ | Garp sur irc undernet | | email: patois@calvix.org | | | Petit film d'animation pour enfants: http://animation.altespace.org |

« previous php.pear.general (#28387) next »