ashikahmad / PrayerTimes-Swift

Islamic Prayer (salah) Time calculation written in swift.
61 stars 21 forks source link

Adjust Isha for Um-Alqura in Ramadan #1

Open laplace opened 9 years ago

laplace commented 9 years ago

In Saudi Arabia, Isha in Ramadan is adjusted to be Maghrib + 2 Hours, I suggest modifying the following part in adjustTimes

    // Adjust Isha
    let cal = NSCalendar(calendarIdentifier: NSCalendarIdentifierIslamicUmmAlQura)
    let month = cal?.component(.CalendarUnitMonth, fromDate: NSDate())
    //If Makkah and Ramadan, the Isha is Maghrib+2.0
    if (self.calculationMethod == .Makkah && month == 9)
    {
        if (!ttimes[TimeNames.Maghrib]!.isNaN){
            ttimes[TimeNames.Isha] = ttimes[TimeNames.Maghrib]! + 2.0
        }
    }
    else {
        if params[3] == 1 { // Isha
            dTime2 = ttimes[TimeNames.Maghrib]! + Double(params[4] / 60.0)
            ttimes[TimeNames.Isha] = dTime2
        }
    }
ashikahmad commented 9 years ago

Thanks, for your awesome suggestion. I will love to fit this sort of things configurable rather than hard-coding in core. So that people can simply set or toggle some properties to have or ignore this type of special cases. In-Sha-Allah, I'll give some effort on this when I get some free time. Thanks again, for your concern.