lib/hijri/converter.rb in hijri-0.0.1 vs lib/hijri/converter.rb in hijri-0.0.5
- old
+ new
@@ -55,11 +55,11 @@
end
def absolute_to_greo(abs)
# Computes the Gregorian date from the absolute date.
# Search forward year by year from approximate year
- year = (abs / (366.0 + 0.5)).to_i
+ year = (abs / 366.0 + 0.5).to_i
while abs >= greo_to_absolute(year + 1, 1, 1)
year += 1
end
# Search forward month by month from January
month = 1
@@ -90,10 +90,10 @@
month = 1
while abs > hijri_to_absolute(year, month, last_day_of_islamic_month(month, year))
month += 1
end
- day = abs - hijri_to_absolute(year, month, 1) - 1
+ day = abs - hijri_to_absolute(year, month, 1) + 1
end
return [year, month, day]
end
end