- # Adar in a leap year
- if ( $isLeap ) {
- # Leap year - has Adar I, with 30 days, and Adar II, with 29 days
- $days = 30;
+ # Leap year - has Adar I, with 30 days, and Adar II, with 29 days
+ $days = 30;
+ if ( $hebrewDay <= $days ) {
+ # Day in Adar I
+ $hebrewMonth = 13;
+ } else {
+ # Subtract the days of Adar I
+ $hebrewDay -= $days;
+ # Try Adar II
+ $days = 29;