Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Diyanet İşleri Başkanlığı as a calculation method #23

Closed
telip007 opened this issue May 30, 2016 · 54 comments
Closed

Add Diyanet İşleri Başkanlığı as a calculation method #23

telip007 opened this issue May 30, 2016 · 54 comments

Comments

@telip007
Copy link

Assalamu aleykum, is it possible to add Diyanet İşleri Başkanlığı as a calculation method ? :)

@z3bi
Copy link
Contributor

z3bi commented Jun 1, 2016

We would love to. Do you have a reference for how they do their calculation?

@khalid-hussain
Copy link

If it helps, their prayer time calculator is available online here.

@telip007
Copy link
Author

telip007 commented Jun 1, 2016

@khalid-hussain thank you
searched so long for this ...

@telip007
Copy link
Author

telip007 commented Jun 1, 2016

But I can't really find resources about how they calculate, I want to build an adhan app and try to provide the most calculation methods as possible

@z3bi
Copy link
Contributor

z3bi commented Jun 1, 2016

This seems like it may be an explanation for the Diyanet method http://www.namazvakti.com/en.1.pdf

I will try to add the calculations into our next version

@khalid-hussain
Copy link

khalid-hussain commented Jun 1, 2016

@z3bi, I too came across this but was/am not sure of its authenticity.

@z3bi
Copy link
Contributor

z3bi commented Jun 1, 2016

We can use times from http://takvim.diyanet.gov.tr/en-US/PrayerTimes to create an automated test for the method so we can validate the method before merging it in.

@khalid-hussain
Copy link

Scanning the source of the calculator I posted, the GetPrayerTimes() function from content.js is responsible, but I don't know enough Javascript to figure it out.

@z3bi
Copy link
Contributor

z3bi commented Jun 1, 2016

That javascript function is loading the data from an ajax call, so the calculation is being done server side. Perhaps someone who knows Turkish could contact them and ask for more information on how prayer times are calculated?

@telip007
Copy link
Author

telip007 commented Jun 1, 2016

I could do that

@telip007
Copy link
Author

telip007 commented Jun 1, 2016

I maybe found a book... I will go through and let you guys know :)

@telip007
Copy link
Author

telip007 commented Jun 3, 2016

bildschirmfoto 2016-06-03 um 19 44 49

Guys, why do I get so unrealistic prayer times for my location, in apps and the times provided by mwl I get other times

bildschirmfoto 2016-06-03 um 19 47 07

@telip007
Copy link
Author

telip007 commented Jun 3, 2016

I mean Fajr at 7 pm ? :D

@z3bi
Copy link
Contributor

z3bi commented Jun 3, 2016

Adhan provides NSDate objects which have a time set in UTC, when formatting the times make sure to use the correct timezone for your formatter.

@z3bi
Copy link
Contributor

z3bi commented Jun 3, 2016

If thats not the issue please post the code you used to get those times

@telip007
Copy link
Author

telip007 commented Jun 3, 2016

it is the javascript example, just insert my coordinates

@z3bi
Copy link
Contributor

z3bi commented Jun 3, 2016

In the JS example, the function formattedTime(-4) is putting it in the EST timezone (-4 hours from UTC). Change the -4 to the proper UTC offset for the location.

@telip007
Copy link
Author

telip007 commented Jun 3, 2016

Oh, I live in CET

@telip007
Copy link
Author

telip007 commented Jun 3, 2016

But 1:15 am is still wrong
when it comes to mwl

@z3bi
Copy link
Contributor

z3bi commented Jun 3, 2016

I'm also guessing you are using a location thats somewhat far north, try setting another High Latitude Rule.

params.highLatitudeRule = HighLatitudeRule.SeventhOfTheNight;

@telip007
Copy link
Author

telip007 commented Jun 3, 2016

Ok thank you :)

@telip007
Copy link
Author

telip007 commented Jun 3, 2016

But how can I automatically read that out ?

@telip007
Copy link
Author

telip007 commented Jun 3, 2016

Which rule I have to use...

@telip007
Copy link
Author

telip007 commented Jun 3, 2016

Also it was TwilightAngle...

@z3bi
Copy link
Contributor

z3bi commented Jun 3, 2016

One of the next things we hope to add is a function to give the recommended calculation parameters for a location. The difficult thing is theres no official source for which high latitude rule to use, they're just different ways to approximate prayer times in places with unreasonable twilight times.

@z3bi
Copy link
Contributor

z3bi commented Jun 16, 2016

@telip007 any update on the book?

@telip007
Copy link
Author

I did found a calculation method in a another source code, and it is running but not 100% the same as diyanet, asr and isha times are different...

@telip007
Copy link
Author

And fajr times

@telip007
Copy link
Author

@telip007
Copy link
Author

You can read it in Adhan.swift :)

@telip007
Copy link
Author

I tested it over 14 days and it is functioning very well, even for other cities...

@z3bi
Copy link
Contributor

z3bi commented Jun 16, 2016

Would it be possible for you to add JSON file with your tests? You can see examples in https://github.com/batoulapps/Adhan/tree/master/Times

@telip007
Copy link
Author

I will do it later InshALLAH, now it is Iftar time here :)

@telip007
Copy link
Author

Hey man, sorry had a lot to do... I hope I can do it today :)

@sgtsquiggs sgtsquiggs changed the title Request Add Diyanet İşleri Başkanlığı as a calculation method Dec 18, 2016
@meltuhamy
Copy link
Contributor

Assalamo alaikom, any updates with this?

@z3bi
Copy link
Contributor

z3bi commented Mar 20, 2017

@meltuhamy it seems we never landed on an authentic source describing how the Diyanet calculation method works. It may be worthwhile attempting to use the description in the PDF mentioned above but it does seem like a significant effort as it is not simply different twilight angles like other methods. As such, I was really hoping for a more authentic source before investing the time and effort. I still think if someone speaks Turkish it's probably worth contacting the people at http://takvim.diyanet.gov.tr/ and asking them for more information.

@basememara
Copy link
Contributor

I tried contacting them several weeks ago, but of course no response. Just bumping this up in case anyone had any updates or other ideas.

@z3bi
Copy link
Contributor

z3bi commented Sep 26, 2017

@basememara I'm willing to sit down and go through the PDF and find what makes this method different, but it would be very helpful if someone used the times in the official site to create a json timetable file for our unit tests so I could compare against that as I worked.

@basememara
Copy link
Contributor

Ok I've attached the json test cases for several cities along with the results from the diyanet.gov site.

However, note that because the site uses country/city and the unit tests are coordinates, there will be a margin of difference since the unit tests are more precise. Also, I assumed Shafi and MiddleOfTheNight since the site didn't specify or give options for those.

diyanet_tests.zip

@z3bi
Copy link
Contributor

z3bi commented Sep 28, 2017

Thank you so much for doing this, if you could modify the tests slightly. I prefer to do at least one day for every month. Just something to make sure we're covering winter and summer months as they can have very different prayer times.

@basememara
Copy link
Contributor

basememara commented Sep 28, 2017

Good idea 👍

Unfortunately, the gov site only returns the current month. I tried modifying the request, but it's just a GET request with only the location parameter. It seems like the server internally assumes current date without exposing this option.

Anyone know another official or reliable place to get these prayer times for specific dates?

@Al-Muhandis
Copy link

Assalamu aleykum!
I have now tested the times listed on the site of the diyanet http://takvim.diyanet.gov.tr/en-US/PrayerTimes . It turned out that Fajr 18 °, Isha 17 °. Zuhr has a 7-minute security shift. An interesting situation is obtained with the time of Asp. The shadow ratio is equal to one, and not the 2nd shadow, as is accepted among Hanafites, for example, in Russia. However, this is not surprising, since in reality inside the Hanafi madhhab there are three opinions about this: a single, double and even, it seems, a 1.5 shadow

@z3bi
Copy link
Contributor

z3bi commented Feb 22, 2018

@Al-Muhandis a fajr angle of 18 and an isha angle of 17 works throughout the year? Would it be possible to contribute a test json file, you can see other ones here https://github.com/batoulapps/Adhan/tree/master/Times

@Al-Muhandis
Copy link

@z3bi unfortunately, I do not know how to see what their schedule (http://takvim.diyanet.gov.tr/en-US/PrayerTimes) is for the whole year. Besides, I did not calculate using your code, but with my code and even in another language, but I think the difference should not be significant.
I wanted to help you with the angle of the sun etc in other words calculation parameters. In my code, the above values in the time range that I foresee give the same values of the prayer times as on the above site

@z3bi
Copy link
Contributor

z3bi commented Feb 22, 2018

@Al-Muhandis thank you for the explanation. My (somewhat limited) understanding of the Diyanet method is that it you can't replicate it by taking existing angle based calculation methods and then finding the correct angle. You might find an angle that works for today, but that same angle in a few months from now would produce incorrect times.

@Al-Muhandis
Copy link

Al-Muhandis commented Feb 22, 2018

@z3bi I understand what you mean. I myself came across similar methods (rather their absence) for some mosques. If it could see the time of prayer for the whole year, I would try to check

@basememara
Copy link
Contributor

According to this library, it's using these offsets for its "Diyanet İşleri Başkanlığı" calculation:

'Diyanet': {
  'name': 'Diyanet İşleri Başkanlığı',
  'params': { 'fajr': 18, 'isha': 17 },
  'offsets': { 'fajr': -2, 'sunrise': -6, 'dhuhr': 7, 'asr': 4, 'maghrib': 7, 'isha': 1 }
},

Seems to match closely with the official site.

Not sure how Muslim Pro is able to get so close unless it's using offsets too.

@telip007
Copy link
Author

telip007 commented Aug 1, 2019

Can you post your results when you use these offsets? Expected from the official site and what you get?

@z3bi
Copy link
Contributor

z3bi commented Aug 6, 2019

Using these parameters:

params.fajrAngle = 18
params.ishaAngle = 17
params.adjustments = PrayerAdjustments(fajr: 0, sunrise: -7, dhuhr: 5, asr: 5, maghrib: 8, isha: 1)

I got these values for coordinates latitude: 41.040725, longitude: 28.660019 (comparing against Turkey, Istanbul, Esenyurt District)

2019-08-06

Adhan official site
04:16 04:16
05:59 05:58
13:16 13:16
17:09 17:09
20:24 20:24
21:59 21:59

2019-09-05

Adhan official site
04:59 04:59
06:28 06:28
13:09 13:09
16:47 16:47
19:40 19:40
21:03 21:03

These look promising but to verify we need the official times for a full year, I don't seem to see the option for that on the official website.

@z3bi
Copy link
Contributor

z3bi commented Aug 7, 2019

I found a website with the official prayer times that and the date in the URL can be changed to get the prayer times for any day https://www.yenisafak.com/en/ankara-prayer-times-01.8.2019

I am going to put together a sampling of data for the year and see how it performs with the parameters we have tried so far.

@z3bi
Copy link
Contributor

z3bi commented Aug 8, 2019

Ok so I tweaked the parameters again, this is the closest I can get it.

var params = CalculationParameters(fajrAngle: 18, ishaAngle: 17, method: self)
params.methodAdjustments = PrayerAdjustments(fajr: 0, sunrise: -7, dhuhr: 5, asr: 4, maghrib: 7, isha: 0)

Testing Ankara-Turkey.json (24 days)
################
Time Test Output
Times for Ankara-Turkey.json - Turkey
2019-1-1
F: 6:33 AM    JSON: 6:33 AM    Diff: 0
S: 8:03 AM    JSON: 8:03 AM    Diff: 0
D: 12:57 PM   JSON: 12:57 PM   Diff: 0
A: 3:20 PM    JSON: 3:20 PM    Diff: 0
M: 5:41 PM    JSON: 5:40 PM    Diff: 1
I: 7:06 PM    JSON: 7:05 PM    Diff: 1
2019-1-15
F: 6:33 AM    JSON: 6:33 AM    Diff: 0
S: 8:02 AM    JSON: 8:02 AM    Diff: 0
D: 1:03 PM    JSON: 1:03 PM    Diff: 0
A: 3:33 PM    JSON: 3:32 PM    Diff: 1
M: 5:55 PM    JSON: 5:54 PM    Diff: 1
I: 7:18 PM    JSON: 7:17 PM    Diff: 1
2019-2-1
F: 6:25 AM    JSON: 6:25 AM    Diff: 0
S: 7:51 AM    JSON: 7:51 AM    Diff: 0
D: 1:07 PM    JSON: 1:07 PM    Diff: 0
A: 3:50 PM    JSON: 3:49 PM    Diff: 1
M: 6:14 PM    JSON: 6:14 PM    Diff: 0
I: 7:35 PM    JSON: 7:34 PM    Diff: 1
2019-2-15
F: 6:11 AM    JSON: 6:11 AM    Diff: 0
S: 7:35 AM    JSON: 7:35 AM    Diff: 0
D: 1:08 PM    JSON: 1:08 PM    Diff: 0
A: 4:03 PM    JSON: 4:02 PM    Diff: 1
M: 6:31 PM    JSON: 6:30 PM    Diff: 1
I: 7:50 PM    JSON: 7:49 PM    Diff: 1
2019-3-1
F: 5:53 AM    JSON: 5:53 AM    Diff: 0
S: 7:16 AM    JSON: 7:16 AM    Diff: 0
D: 1:06 PM    JSON: 1:06 PM    Diff: 0
A: 4:15 PM    JSON: 4:14 PM    Diff: 1
M: 6:47 PM    JSON: 6:46 PM    Diff: 1
I: 8:05 PM    JSON: 8:04 PM    Diff: 1
2019-3-15
F: 5:31 AM    JSON: 5:31 AM    Diff: 0
S: 6:54 AM    JSON: 6:54 AM    Diff: 0
D: 1:03 PM    JSON: 1:03 PM    Diff: 0
A: 4:24 PM    JSON: 4:23 PM    Diff: 1
M: 7:02 PM    JSON: 7:01 PM    Diff: 1
I: 8:20 PM    JSON: 8:19 PM    Diff: 1
2019-4-1
F: 5:01 AM    JSON: 5:01 AM    Diff: 0
S: 6:27 AM    JSON: 6:27 AM    Diff: 0
D: 12:58 PM   JSON: 12:58 PM   Diff: 0
A: 4:32 PM    JSON: 4:31 PM    Diff: 1
M: 7:19 PM    JSON: 7:19 PM    Diff: 0
I: 8:40 PM    JSON: 8:39 PM    Diff: 1
2019-4-15
F: 4:35 AM    JSON: 4:35 AM    Diff: 0
S: 6:05 AM    JSON: 6:05 AM    Diff: 0
D: 12:54 PM   JSON: 12:54 PM   Diff: 0
A: 4:36 PM    JSON: 4:35 PM    Diff: 1
M: 7:34 PM    JSON: 7:33 PM    Diff: 1
I: 8:57 PM    JSON: 8:56 PM    Diff: 1
2019-5-1
F: 4:07 AM    JSON: 4:07 AM    Diff: 0
S: 5:43 AM    JSON: 5:43 AM    Diff: 0
D: 12:51 PM   JSON: 12:51 PM   Diff: 0
A: 4:41 PM    JSON: 4:40 PM    Diff: 1
M: 7:50 PM    JSON: 7:49 PM    Diff: 1
I: 9:20 PM    JSON: 9:18 PM    Diff: 2
2019-5-15
F: 3:44 AM    JSON: 3:44 AM    Diff: 0
S: 5:27 AM    JSON: 5:27 AM    Diff: 0
D: 12:50 PM   JSON: 12:50 PM   Diff: 0
A: 4:44 PM    JSON: 4:43 PM    Diff: 1
M: 8:04 PM    JSON: 8:03 PM    Diff: 1
I: 9:40 PM    JSON: 9:39 PM    Diff: 1
2019-6-1
F: 3:24 AM    JSON: 3:24 AM    Diff: 0
S: 5:15 AM    JSON: 5:15 AM    Diff: 0
D: 12:52 PM   JSON: 12:51 PM   Diff: 1
A: 4:48 PM    JSON: 4:48 PM    Diff: 0
M: 8:18 PM    JSON: 8:17 PM    Diff: 1
I: 10:01 PM   JSON: 10:00 PM   Diff: 1
2019-6-15
F: 3:17 AM    JSON: 3:17 AM    Diff: 0
S: 5:12 AM    JSON: 5:12 AM    Diff: 0
D: 12:54 PM   JSON: 12:54 PM   Diff: 0
A: 4:52 PM    JSON: 4:51 PM    Diff: 1
M: 8:26 PM    JSON: 8:26 PM    Diff: 0
I: 10:13 PM   JSON: 10:12 PM   Diff: 1
2019-7-1
F: 3:21 AM    JSON: 3:21 AM    Diff: 0
S: 5:17 AM    JSON: 5:16 AM    Diff: 1
D: 12:58 PM   JSON: 12:57 PM   Diff: 1
A: 4:55 PM    JSON: 4:55 PM    Diff: 0
M: 8:28 PM    JSON: 8:28 PM    Diff: 0
I: 10:15 PM   JSON: 10:15 PM   Diff: 0
2019-7-15
F: 3:35 AM    JSON: 3:35 AM    Diff: 0
S: 5:25 AM    JSON: 5:25 AM    Diff: 0
D: 1:00 PM    JSON: 1:00 PM    Diff: 0
A: 4:55 PM    JSON: 4:56 PM    Diff: -1
M: 8:24 PM    JSON: 8:24 PM    Diff: 0
I: 10:05 PM   JSON: 10:06 PM   Diff: -1
2019-8-1
F: 3:58 AM    JSON: 3:58 AM    Diff: 0
S: 5:40 AM    JSON: 5:40 AM    Diff: 0
D: 1:00 PM    JSON: 1:00 PM    Diff: 0
A: 4:52 PM    JSON: 4:53 PM    Diff: -1
M: 8:10 PM    JSON: 8:10 PM    Diff: 0
I: 9:44 PM    JSON: 9:45 PM    Diff: -1
2019-8-15
F: 4:18 AM    JSON: 4:18 AM    Diff: 0
S: 5:53 AM    JSON: 5:53 AM    Diff: 0
D: 12:58 PM   JSON: 12:58 PM   Diff: 0
A: 4:46 PM    JSON: 4:46 PM    Diff: 0
M: 7:53 PM    JSON: 7:54 PM    Diff: -1
I: 9:21 PM    JSON: 9:22 PM    Diff: -1
2019-9-1
F: 4:40 AM    JSON: 4:40 AM    Diff: 0
S: 6:09 AM    JSON: 6:09 AM    Diff: 0
D: 12:54 PM   JSON: 12:54 PM   Diff: 0
A: 4:33 PM    JSON: 4:34 PM    Diff: -1
M: 7:28 PM    JSON: 7:29 PM    Diff: -1
I: 8:50 PM    JSON: 8:52 PM    Diff: -2
2019-9-15
F: 4:57 AM    JSON: 4:57 AM    Diff: 0
S: 6:22 AM    JSON: 6:22 AM    Diff: 0
D: 12:49 PM   JSON: 12:49 PM   Diff: 0
A: 4:19 PM    JSON: 4:20 PM    Diff: -1
M: 7:05 PM    JSON: 7:06 PM    Diff: -1
I: 8:24 PM    JSON: 8:26 PM    Diff: -2
2019-10-1
F: 5:14 AM    JSON: 5:14 AM    Diff: 0
S: 6:37 AM    JSON: 6:37 AM    Diff: 0
D: 12:44 PM   JSON: 12:44 PM   Diff: 0
A: 4:01 PM    JSON: 4:02 PM    Diff: -1
M: 6:39 PM    JSON: 6:40 PM    Diff: -1
I: 7:56 PM    JSON: 7:58 PM    Diff: -2
2019-10-15
F: 5:29 AM    JSON: 5:28 AM    Diff: 1
S: 6:52 AM    JSON: 6:51 AM    Diff: 1
D: 12:40 PM   JSON: 12:40 PM   Diff: 0
A: 3:45 PM    JSON: 3:46 PM    Diff: -1
M: 6:17 PM    JSON: 6:18 PM    Diff: -1
I: 7:35 PM    JSON: 7:36 PM    Diff: -1
2019-11-1
F: 5:46 AM    JSON: 5:45 AM    Diff: 1
S: 7:10 AM    JSON: 7:10 AM    Diff: 0
D: 12:37 PM   JSON: 12:37 PM   Diff: 0
A: 3:27 PM    JSON: 3:28 PM    Diff: -1
M: 5:54 PM    JSON: 5:55 PM    Diff: -1
I: 7:13 PM    JSON: 7:14 PM    Diff: -1
2019-11-15
F: 6:00 AM    JSON: 5:59 AM    Diff: 1
S: 7:26 AM    JSON: 7:26 AM    Diff: 0
D: 12:38 PM   JSON: 12:38 PM   Diff: 0
A: 3:16 PM    JSON: 3:16 PM    Diff: 0
M: 5:40 PM    JSON: 5:40 PM    Diff: 0
I: 7:01 PM    JSON: 7:02 PM    Diff: -1
2019-12-1
F: 6:15 AM    JSON: 6:14 AM    Diff: 1
S: 7:44 AM    JSON: 7:43 AM    Diff: 1
D: 12:43 PM   JSON: 12:42 PM   Diff: 1
A: 3:09 PM    JSON: 3:10 PM    Diff: -1
M: 5:31 PM    JSON: 5:31 PM    Diff: 0
I: 6:55 PM    JSON: 6:55 PM    Diff: 0
2019-12-15
F: 6:25 AM    JSON: 6:25 AM    Diff: 0
S: 7:56 AM    JSON: 7:56 AM    Diff: 0
D: 12:49 PM   JSON: 12:48 PM   Diff: 1
A: 3:11 PM    JSON: 3:10 PM    Diff: 1
M: 5:31 PM    JSON: 5:31 PM    Diff: 0
I: 6:56 PM    JSON: 6:56 PM    Diff: 0
Difference for Ankara-Turkey.json - Turkey
Average difference: 0.4861111111111111
Max difference: 2.0

I feel like this is close enough to include it. I'll start work on adding it to all the different implementations of the library.

@github-actions
Copy link

Stale issue message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants