Bug #54254 [Opn->Csd]: cal_from_jd returns month = 6 when there is only one Adar
Edit report at https://bugs.php.net/bug.php?id=54254&edit=1
ID: 54254
Updated by: stas@php.net
Reported by: asphp at dsgml dot com
Summary: cal_from_jd returns month = 6 when there is only one
Adar
-Status: Open
+Status: Closed
Type: Bug
Package: Calendar related
PHP Version: 5.3.5
-Assigned To:
+Assigned To: stas
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
fixed in master
Previous Comments:
------------------------------------------------------------------------
[2012-03-29 18:33:50] asphp at dsgml dot com
woordengeschrift you misunderstand the Hebrew calendar.
In non-leap years there is a gap, the calendar months go: 4,5,7,8 - month 6 is skipped.
Unfortunately PHP does 4,5,6,8 - it skips month 7 instead of 6 which is incorrect.
In a leap year it is AdarI that is added - AdarII is the same as Adar. Yes, I know you would expect
the second one to be the "extra", but that's not how the calendar works.
------------------------------------------------------------------------
[2012-03-29 12:13:03] info at woordengeschrift dot nl
In NON-leap years, there is only the unnumbered month of Adar.
------------------------------------------------------------------------
[2012-03-29 12:09:41] info at woordengeschrift dot nl
In leap years, there is only the unnumbered month of Adar.
Numbered Adars only occur in leap years: Adar_I (the actual leap month),
followed by Adar_II.
------------------------------------------------------------------------
[2011-03-15 09:53:50] asphp at dsgml dot com
Description:
------------
cal_from_jd() returns 6 for Adar when there is only one Adar, (it should return 7, since if there is
only one Adar it's AdarII).
It also says "AdarI", which is wrong (it should be either "Adar" or at least
"AdarII").
Furthermore the cal_days_in_month() (correctly) only works with month 7, and not 6 as returned by
cal_from_jd.
Test script:
---------------
<?
print_r(cal_from_jd(2456005, CAL_JEWISH));
echo cal_days_in_month(CAL_JEWISH, 6, 5772) . "\n";
echo cal_days_in_month(CAL_JEWISH, 7, 5772) . "\n";
?>
Expected result:
----------------
The month in cal_from_jd should be 7.
The second two lines demonstrate how cal_days_in_month also expects the month to be 7.
Actual result:
--------------
Array
(
[date] => 6/24/5772
[month] => 6
[day] => 24
[year] => 5772
[dow] => 0
[abbrevdayname] => Sun
[dayname] => Sunday
[abbrevmonth] => AdarI
[monthname] => AdarI
)
0
29
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54254&edit=1
Thread (7 messages)