96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# File 'lib/hijri/converter.rb', line 96
def absolute_to_hijri(abs)
if abs <= ISLAMIC_EPOCH
month = 0
day = 0
year = 0
elsif
year = ((abs - ISLAMIC_EPOCH) / 355.0).to_i
while abs >= hijri_to_absolute(year+1, 1, 1)
year += 1
end
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
end
return [year, month, day]
end
|