Bug #54254 [Com]: cal_from_jd returns month = 6 when there is only one Adar

From: Date: Thu, 29 Mar 2012 12:09:41 +0000
Subject: Bug #54254 [Com]: cal_from_jd returns month = 6 when there is only one Adar
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-168972@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54254&edit=1

 ID:                 54254
 Comment by:         info at woordengeschrift dot nl
 Reported by:        asphp at dsgml dot com
 Summary:            cal_from_jd returns month = 6 when there is only one
                     Adar
 Status:             Open
 Type:               Bug
 Package:            Calendar related
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[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)

« previous php.bugs (#168972) next »