islamic-network / api.aladhan.com

The AlAdhan API
GNU General Public License v3.0
124 stars 32 forks source link

Prayer times differ between timingsByCity and calendarByCity #66

Closed tHeCh0s3n0n3 closed 1 year ago

tHeCh0s3n0n3 commented 1 year ago

While looking to integrate your amazing API in a small tool I'm working on, I noticed a discrepency between timingsByCity and calendarByCity.

For the city I'm checking on (Dubai, AE) the difference is in the Duhr, Sunset and Maghrib. I haven't checked any other cities.

As I write this on 2023-04-02 the following is what is return by https://api.aladhan.com/v1/timingsByCity?city=Dubai&country=AE:

{
    "code": 200,
    "status": "OK",
    "data": {
        "timings": {
            "Fajr": "04:52",
            "Sunrise": "06:10",
            "Dhuhr": "12:26",
            "Asr": "15:51",
            "Sunset": "18:39",
            "Maghrib": "18:39",
            "Isha": "19:54",
            "Imsak": "04:42",
            "Midnight": "00:23",
            "Firstthird": "22:27",
            "Lastthird": "02:18"
        },
        "date": {
            "readable": "02 Apr 2023",
            "timestamp": "1680404400",
            "hijri": {
                "date": "11-09-1444",
                "format": "DD-MM-YYYY",
                "day": "11",
                "weekday": {
                    "en": "Al Ahad",
                    "ar": "الاحد"
                },
                "month": {
                    "number": 9,
                    "en": "Ramaḍān",
                    "ar": "رَمَضان"
                },
                "year": "1444",
                "designation": {
                    "abbreviated": "AH",
                    "expanded": "Anno Hegirae"
                },
                "holidays": []
            },
            "gregorian": {
                "date": "02-04-2023",
                "format": "DD-MM-YYYY",
                "day": "02",
                "weekday": {
                    "en": "Sunday"
                },
                "month": {
                    "number": 4,
                    "en": "April"
                },
                "year": "2023",
                "designation": {
                    "abbreviated": "AD",
                    "expanded": "Anno Domini"
                }
            }
        },
        "meta": {
            "latitude": 25.080209,
            "longitude": 55.283596,
            "timezone": "Asia/Dubai",
            "method": {
                "id": 16,
                "name": "Dubai (experimental)",
                "params": {
                    "Fajr": 18.2,
                    "Isha": 18.2
                },
                "location": {
                    "latitude": 25.0762677,
                    "longitude": 55.087404
                }
            },
            "latitudeAdjustmentMethod": "ANGLE_BASED",
            "midnightMode": "STANDARD",
            "school": "STANDARD",
            "offset": {
                "Imsak": 0,
                "Fajr": 0,
                "Sunrise": 0,
                "Dhuhr": 3,
                "Asr": 0,
                "Maghrib": 3,
                "Sunset": 3,
                "Isha": 0,
                "Midnight": 0
            }
        }
    }
}

However the same date in the calendarByCity shows different prayer times (and dones't have automatic adjustments). URI: https://api.aladhan.com/v1/calendarByCity?city=Dubai&country=AE&month=04&year=2023 Relevant part of the result:

{
    "code": 200,
    "status": "OK",
    "data": [
        { ...
        },
        {
            "timings": {
                "Fajr": "04:52 (+04)",
                "Sunrise": "06:10 (+04)",
                "Dhuhr": "12:23 (+04)",
                "Asr": "15:51 (+04)",
                "Sunset": "18:36 (+04)",
                "Maghrib": "18:36 (+04)",
                "Isha": "19:54 (+04)",
                "Imsak": "04:42 (+04)",
                "Midnight": "00:23 (+04)",
                "Firstthird": "22:27 (+04)",
                "Lastthird": "02:18 (+04)"
            },
            "date": {
                "readable": "02 Apr 2023",
                "timestamp": "1680411661",
                "gregorian": {
                    "date": "02-04-2023",
                    "format": "DD-MM-YYYY",
                    "day": "02",
                    "weekday": {
                        "en": "Sunday"
                    },
                    "month": {
                        "number": 4,
                        "en": "April"
                    },
                    "year": "2023",
                    "designation": {
                        "abbreviated": "AD",
                        "expanded": "Anno Domini"
                    }
                },
                "hijri": {
                    "date": "11-09-1444",
                    "format": "DD-MM-YYYY",
                    "day": "11",
                    "weekday": {
                        "en": "Al Ahad",
                        "ar": "الاحد"
                    },
                    "month": {
                        "number": 9,
                        "en": "Ramaḍān",
                        "ar": "رَمَضان"
                    },
                    "year": "1444",
                    "designation": {
                        "abbreviated": "AH",
                        "expanded": "Anno Hegirae"
                    },
                    "holidays": []
                }
            },
            "meta": {
                "latitude": 25.080209,
                "longitude": 55.283596,
                "timezone": "Asia/Dubai",
                "method": {
                    "id": 16,
                    "name": "Dubai (experimental)",
                    "params": {
                        "Fajr": 18.2,
                        "Isha": 18.2
                    },
                    "location": {
                        "latitude": 25.0762677,
                        "longitude": 55.087404
                    }
                },
                "latitudeAdjustmentMethod": "ANGLE_BASED",
                "midnightMode": "STANDARD",
                "school": "STANDARD",
                "offset": {
                    "Imsak": 0,
                    "Fajr": 0,
                    "Sunrise": 0,
                    "Dhuhr": 0,
                    "Asr": 0,
                    "Maghrib": 0,
                    "Sunset": 0,
                    "Isha": 0,
                    "Midnight": 0
                }
            }
        },
        {
            ...
        }
    ]
}

Shouldn't both endpoints be returning the same data or am I missing something?

meezaan commented 1 year ago

The offset is missing in the latter, which means something is amiss in the code. I will have a look. Thank you for letting me know.

meezaan commented 1 year ago

I've just pushed a fix. Should be deployed in the next 2-3 minutes. Thank you!

meezaan commented 1 year ago

Timings now match.