Esempio n. 1
0
    def _get_ishaa_time(self):
        if (type(self._conf.ishaa_angle) is FixedTime):
            is_ramadan = HijriDate.get_hijri(self._date,
                                             self._correction_val).month == 9

            time_after_maghreb = self._conf.ishaa_angle.ramadan_time_hr if is_ramadan else self._conf.ishaa_angle.all_year_time_hr

            ishaa_t = (time_after_maghreb + self._dohr_time +
                       self._get_time_for_angle(self._conf.maghreb_angle))
        else:
            ishaa_t = self._dohr_time + \
                self._get_time_for_angle(self._conf.ishaa_angle)
        return ishaa_t
 def ishaa_time(self, shift=0.0):
     '''Get the Ishaa time'''
     if (self._conf.ishaa_zenith is None):
         # ishaa_zenith==None <=> method == Umm al-Qura University, Makkah
         if HijriDate.get_hijri(self._date,
                               self._correction_val).month == 9:
             ishaa_t = self._dohr_time()
             + self._time(self._conf.maghreb_zenith) + 2.0
         else:
             ishaa_t = self._dohr_time()
             + self._time(self._conf.maghreb_zenith) + 1.5
     else:
         ishaa_t = self._time(self._conf.ishaa_zenith)
         ishaa_t = self._dohr_time() + ishaa_t
     return Prayer._hours_to_time(ishaa_t, shift,
                                        self._conf.summer_time)
Esempio n. 3
0
def test_hijri():
    hijri_date = HijriDate(1442, 8, 25)
    tomorrow = hijri_date.next_date()
    gregorian = hijri_date.to_gregorian()
    hijri_from_gregorian = hijri_date.get_hijri(date(2021, 4, 9))
    hijri_from_julian = hijri_date.from_julian(2459313)

    assert hijri_date.format() == "25-08-1442"
    # FIXME according to https://www.islamicfinder.org/islamic-calendar/
    # it should be 27 Shaban 1442
    assert hijri_date.format(2) == "25 Shaban 1442"
    assert tomorrow.format() == "26-08-1442"
    assert tomorrow.format(2) == "26 Shaban 1442"

    assert gregorian == date(2021, 4, 13)

    assert hijri_from_gregorian.format(2) == "25 Shaban 1442"
    assert hijri_from_julian.format(2) == "25 Shaban 1442"