islamic-network / api.aladhan.com

The AlAdhan API
GNU General Public License v3.0
118 stars 30 forks source link

Inconsistent day between play and v1 timingsByCity #34

Closed AlGantori closed 4 years ago

AlGantori commented 4 years ago

The following URL displays day as 17

https://aladhan.com/play/Corvallis/OR,%20USA 

image

whereas the API returns 16

http://api.aladhan.com/v1/timingsByCity?city=Corvallis&country=USA&method=2

image

What am I missing?

BTW, where is the source for /play/ located ?

Thank you.

meezaan commented 4 years ago

Salaam. The code for the web app is available here: https://github.com/islamic-network/aladhan.com.

There is an adjustment parameter in the API - the app uses that. It's set here https://github.com/islamic-network/aladhan.com/blob/master/src/dependencies.php#L33 when the application bootstraps.

AlGantori commented 4 years ago

So I looked at the link and could not make sense of this php function returning 1? (sorry I am not that familiar with php/JS).

$container['gToHAdjustment'] = function($c) {
    return 1;
};

I could not figure out what is meant by "There is an adjustment parameter in the API - the app uses that"

Could you please elaborate. Thank you.

meezaan commented 4 years ago

If you see https://aladhan.com/prayer-times-api#GetTimings for instance, the API takes a parameter called adjustment, which adjusts the hijri date by the number of days passed to adjustment.

The app passes one for this parameter each time it calls the API - that's why it's date is 1 day a head of the API response you are seeing.

AlGantori commented 4 years ago

If this link is using an adjustment https://aladhan.com/play/Los%20Angeles/CA,%20USA it is not exposing it.

The bottom-line the displayed "18 Ramadan" is wrong according to our fasting in this timezone May 10th corresponds to 17 Ramadan and that's what the other calendars are displaying, not 18 Ramadan.

This is link is correct

https://aladhan.com/ramadan-prayer-times/2020/Los%20Angeles/CA,%20USA

meezaan commented 4 years ago

The app does not expose API variables in the URL - it does not need to.

If that was the problem it would have been helpful to mention that earlier on - you will notice the problem is consistent across the app - like https://aladhan.com/gregorian-hijri-calendar, for instance.

I will change the adjustment to 0 and the issue will go away in 5 mins or so.