batoulapps / adhan-swift

High precision Islamic prayer time library for Swift
MIT License
182 stars 42 forks source link

Turkey (Diyanet İşleri Başkanlığı) times for fajr and isha are far off #62

Open musa11971 opened 3 years ago

musa11971 commented 3 years ago

So I'm not sure what's causing this strange issue, but the times for fajr and isha seem to be incorrect when using Diyanet İşleri Başkanlığı ("Turkey" method) from Amsterdam.

Consider the following example:

// Today
let cal = Calendar(identifier: .gregorian)
let date = cal.dateComponents([.year, .month, .day], from: Date())

var params = CalculationMethod.turkey.params

// Coordinates: 52.370788279620946, 4.889882572782284 (Amsterdam)
let times = PrayerTimes(coordinates: Coordinates(latitude: 52.370788279620946, longitude: 4.889882572782284), date: date, calculationParameters: params)!

This produces incorrect times. Below I have put them next to the correct times (according to diyanet.gov.tr):

Adhan-Swift Diyanet.gov.tr
Fajr 01:41 ❌ 03:47 ✅
Dhuhr 13:46 ✅ 13:45 ✅ (diff: 1)
Asr 18:09 ✅ 18:09 ✅ (no diff)
Maghrib 22:10 ✅ 22:10 ✅ (no diff)
Isha 01:41 ❌ 23:24 ✅

This seems very odd to me, because the values for fajr and isha are identical, and they are also both far off from the correct time.

This issue may be related/useful.

z3bi commented 3 years ago

Amsterdam is at a very high latitude and generally that would mean you should implement the highLatitudeRule parameter. However even trying those options I'm not finding an exact match with the Diyanet times. I will continue to look into this further.

musa11971 commented 3 years ago

Looks like params.highLatitudeRule = .seventhOfTheNight gives the best results. But fajr and ishaa are still hours off. They are however no longer the same value (like they were without the highLatitudeRule).

z3bi commented 3 years ago

@musa11971 a change was recently made in the develop branch that will try and apply a highLatitudeRule based off of the supplied coordinates if one is not manually specified. So that should the incorrect times. But to match what Diyanet has we need to figure out what they're doing for high latitudes, which seems to be a different approach.

musa11971 commented 3 years ago

I don't speak Turkish myself, so I mailed the Dutch Diyanet branch on monday to see if they have more information on how they calculate the times. Hopefully they can help.

What I also noticed is that Muslim pro, when set to Diyanet, also fails to get the correct times:

Muslim Pro:

Screenshot 2021-06-16 at 21 11 23

Diyanet official:

Screenshot 2021-06-16 at 21 11 42

So yeah, seems like they face the same challenge :)

Frequence-xx commented 3 years ago

I have a similar issue, but we use the French calculation (Union des Organisations Islamiques de France) based on 12 degrees in the Netherlands, but the times are off only around summertime. Islamic Finder has the correct time for fajr and isha based on the french calculation method which is in accordance with eye-sighting. Any ideas?

Prayer times on July 13th 2021

Adhan-Java | Islamic Finder Fajr | 03:39 ❌ | 04:13 ✅ Isha | 23:50 ❌ | 23:16 ✅
amacanada commented 2 years ago

I posted the explanation here from Diyanet's website regarding how they determine isha and fajr: https://github.com/achaudhry/adhan/issues/2#issuecomment-1111585970

metin-atalay commented 1 year ago

I have the same issue .

let coordinates = Coordinates(latitude: 40.8809, longitude: 29.2577)

image
oalejel commented 10 months ago

+1, the Diyanet inaccuracies are still off by a few minutes. Let's explore how to better calculate times based on the official Turkish method.

mertnacakgedigi commented 6 months ago

any update on this?