diff options
| -rw-r--r-- | ext/calendar/calendar.c | 4 | ||||
| -rw-r--r-- | ext/calendar/jewish.c | 4 | ||||
| -rw-r--r-- | ext/calendar/sdncal.h | 3 | ||||
| -rw-r--r-- | ext/calendar/tests/jdmonthname.phpt | 4 | ||||
| -rw-r--r-- | ext/calendar/tests/jdtojewish.phpt | 8 |
5 files changed, 14 insertions, 9 deletions
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c index 1ab1f1652e..5947aabc98 100644 --- a/ext/calendar/calendar.c +++ b/ext/calendar/calendar.c @@ -204,8 +204,8 @@ static struct cal_entry_t cal_conversion_table[CAL_NUM_CALS] = { FrenchMonthName, FrenchMonthName} }; -#define JEWISH_MONTH_NAME(year) ((monthsPerYear[(year) % 19] == 13)?JewishMonthNameLeap:JewishMonthName) -#define JEWISH_HEB_MONTH_NAME(year) ((monthsPerYear[(year) % 19] == 13)?JewishMonthHebNameLeap:JewishMonthHebName) +#define JEWISH_MONTH_NAME(year) ((monthsPerYear[((year)-1) % 19] == 13)?JewishMonthNameLeap:JewishMonthName) +#define JEWISH_HEB_MONTH_NAME(year) ((monthsPerYear[((year)-1) % 19] == 13)?JewishMonthHebNameLeap:JewishMonthHebName) /* For jddayofweek */ enum { CAL_DOW_DAYNO, CAL_DOW_SHORT, CAL_DOW_LONG }; diff --git a/ext/calendar/jewish.c b/ext/calendar/jewish.c index 494d065962..a5849a7d76 100644 --- a/ext/calendar/jewish.c +++ b/ext/calendar/jewish.c @@ -86,7 +86,7 @@ * 4 Tevet 29 29 29 29 29 29 * 5 Shevat 30 30 30 30 30 30 * 6 Adar I -- -- -- 30 30 30 (optional) - * 7 Adar II 29 29 29 29 29 29 + * 7 Adar (II) 29 29 29 29 29 29 * 8 Nisan 30 30 30 30 30 30 * 9 Iyyar 29 29 29 29 29 29 * 10 Sivan 30 30 30 30 30 30 @@ -286,7 +286,7 @@ #define AM3_11_20 ((9 * HALAKIM_PER_HOUR) + 204) #define AM9_32_43 ((15 * HALAKIM_PER_HOUR) + 589) -static int monthsPerYear[19] = +int monthsPerYear[19] = { 12, 12, 13, 12, 12, 13, 12, 13, 12, 12, 13, 12, 12, 13, 12, 12, 13, 12, 13 }; diff --git a/ext/calendar/sdncal.h b/ext/calendar/sdncal.h index 81328d1369..c0463c80d4 100644 --- a/ext/calendar/sdncal.h +++ b/ext/calendar/sdncal.h @@ -79,7 +79,10 @@ long int JulianToSdn(int year, int month, int day); void SdnToJewish(long int sdn, int *pYear, int *pMonth, int *pDay); long int JewishToSdn(int year, int month, int day); extern char *JewishMonthName[14]; +extern char *JewishMonthNameLeap[14]; extern char *JewishMonthHebName[14]; +extern char *JewishMonthHebNameLeap[14]; +extern int monthsPerYear[19]; /* French republic calendar conversions. */ void SdnToFrench(long int sdn, int *pYear, int *pMonth, int *pDay); diff --git a/ext/calendar/tests/jdmonthname.phpt b/ext/calendar/tests/jdmonthname.phpt index d05d3c595e..207d320162 100644 --- a/ext/calendar/tests/jdmonthname.phpt +++ b/ext/calendar/tests/jdmonthname.phpt @@ -178,7 +178,7 @@ Heshvan Kislev Tevet Shevat -AdarI +Adar Nisan Iyyar Sivan @@ -279,7 +279,7 @@ Heshvan Kislev Tevet Shevat -AdarI +Adar Nisan Iyyar Sivan diff --git a/ext/calendar/tests/jdtojewish.phpt b/ext/calendar/tests/jdtojewish.phpt index 484b95749c..bc0ecbdd88 100644 --- a/ext/calendar/tests/jdtojewish.phpt +++ b/ext/calendar/tests/jdtojewish.phpt @@ -14,10 +14,11 @@ var_dump(jdtojewish(gregoriantojd(10,28,2002))."\r\n". jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM)."\r\n". jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM)."\r\n". - jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n"); + jdtojewish(gregoriantojd(10,8,2002),true, CAL_JEWISH_ADD_GERESHAYIM+CAL_JEWISH_ADD_ALAFIM+CAL_JEWISH_ADD_ALAFIM_GERESH)."\r\n". + jdtojewish(gregoriantojd(3,10,2007))."\r\n"); ?> ---EXPECT-- -string(184) "2/22/5763 +--EXPECTF-- +string(%d) "2/22/5763 כב חשון התשסג כב חשון ה'תשסג כב חשון ה אלפים תשסג @@ -27,4 +28,5 @@ string(184) "2/22/5763 ב' חשון ה'תשס"ג ב' חשון ה אלפים תשס"ג ב' חשון ה' אלפים תשס"ג +7/20/5767 " |
