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

Missing Ramadan days with adjustment #53

Open
Roaa94 opened this issue Apr 3, 2022 · 1 comment
Open

Missing Ramadan days with adjustment #53

Roaa94 opened this issue Apr 3, 2022 · 1 comment

Comments

@Roaa94
Copy link

Roaa94 commented Apr 3, 2022

The Hijri calendar in the calendar endpoint is not correct.
1st day of Ramadan should be on April 2nd, however it's on April 4th.

I used the adjustment=2 param to get Ramadan 1st to be on April 2nd. But Ramadan 2nd was missing from the response. It jumps directly from Ramadan 1st to Ramadan 3rd. So now instead of April 3rd being Ramadan 2nd, it's Ramadan 3rd.

Endpoint: https://api.aladhan.com/v1/calendar
Params:
latitude: 41.017153708870126
longitude: 28.977153766843355
method: 13
month: 4
adjustment: 2

Full route:
https://api.aladhan.com/v1/calendar?latitude=41.017153708870126&longitude=28.977153766843355&method=13&month=4&iso8601=true&adjustment=2

Response: (Ramadan 2nd is missing):

{
  "code": 200,
  "status": "OK",
  "data": [
    {
      "timings": {
        "Fajr": "2022-04-01T05:14:00+03:00 (+03)",
        "Sunrise": "2022-04-01T06:48:00+03:00 (+03)",
        "Dhuhr": "2022-04-01T13:08:00+03:00 (+03)",
        "Asr": "2022-04-01T16:42:00+03:00 (+03)",
        "Sunset": "2022-04-01T19:29:00+03:00 (+03)",
        "Maghrib": "2022-04-01T19:29:00+03:00 (+03)",
        "Isha": "2022-04-01T20:58:00+03:00 (+03)",
        "Imsak": "2022-04-01T05:04:00+03:00 (+03)",
        "Midnight": "2022-04-02T01:08:00+03:00 (+03)"
      },
      "date": {
        "readable": "01 Apr 2022",
        "timestamp": "1648792861",
        "gregorian": {
          "date": "01-04-2022",
          "format": "DD-MM-YYYY",
          "day": "01",
          "weekday": {
            "en": "Friday"
          },
          "month": {
            "number": 4,
            "en": "April"
          },
          "year": "2022",
          "designation": {
            "abbreviated": "AD",
            "expanded": "Anno Domini"
          }
        },
        "hijri": {
          "date": "30-08-1443",
          "format": "DD-MM-YYYY",
          "day": "30",
          "weekday": {
            "en": "Al Juma'a",
            "ar": "\u0627\u0644\u062c\u0645\u0639\u0629"
          },
          "month": {
            "number": 8,
            "en": "Sha\u02bfb\u0101n",
            "ar": "\u0634\u064e\u0639\u0652\u0628\u0627\u0646"
          },
          "year": "1443",
          "designation": {
            "abbreviated": "AH",
            "expanded": "Anno Hegirae"
          },
          "holidays": []
        }
      },
      "meta": {
        "latitude": 41.017153708870126,
        "longitude": 28.977153766843355,
        "timezone": "Europe\/Istanbul",
        "method": {
          "id": 13,
          "name": "Diyanet \u0130\u015fleri Ba\u015fkanl\u0131\u011f\u0131, Turkey",
          "params": {
            "Fajr": 18,
            "Isha": 17
          },
          "location": {
            "latitude": 39.9333635,
            "longitude": 32.8597419
          }
        },
        "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
        }
      }
    },
    {
      "timings": {
        "Fajr": "2022-04-02T05:12:00+03:00 (+03)",
        "Sunrise": "2022-04-02T06:46:00+03:00 (+03)",
        "Dhuhr": "2022-04-02T13:08:00+03:00 (+03)",
        "Asr": "2022-04-02T16:42:00+03:00 (+03)",
        "Sunset": "2022-04-02T19:30:00+03:00 (+03)",
        "Maghrib": "2022-04-02T19:30:00+03:00 (+03)",
        "Isha": "2022-04-02T20:59:00+03:00 (+03)",
        "Imsak": "2022-04-02T05:02:00+03:00 (+03)",
        "Midnight": "2022-04-03T01:08:00+03:00 (+03)"
      },
      "date": {
        "readable": "02 Apr 2022",
        "timestamp": "1648879261",
        "gregorian": {
          "date": "02-04-2022",
          "format": "DD-MM-YYYY",
          "day": "02",
          "weekday": {
            "en": "Saturday"
          },
          "month": {
            "number": 4,
            "en": "April"
          },
          "year": "2022",
          "designation": {
            "abbreviated": "AD",
            "expanded": "Anno Domini"
          }
        },
        "hijri": {
          "date": "01-09-1443",
          "format": "DD-MM-YYYY",
          "day": "01",
          "weekday": {
            "en": "Al Sabt",
            "ar": "\u0627\u0644\u0633\u0628\u062a"
          },
          "month": {
            "number": 9,
            "en": "Rama\u1e0d\u0101n",
            "ar": "\u0631\u064e\u0645\u064e\u0636\u0627\u0646"
          },
          "year": "1443",
          "designation": {
            "abbreviated": "AH",
            "expanded": "Anno Hegirae"
          },
          "holidays": [
            "1st Day of Ramadan"
          ]
        }
      },
      "meta": {
        "latitude": 41.017153708870126,
        "longitude": 28.977153766843355,
        "timezone": "Europe\/Istanbul",
        "method": {
          "id": 13,
          "name": "Diyanet \u0130\u015fleri Ba\u015fkanl\u0131\u011f\u0131, Turkey",
          "params": {
            "Fajr": 18,
            "Isha": 17
          },
          "location": {
            "latitude": 39.9333635,
            "longitude": 32.8597419
          }
        },
        "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
        }
      }
    },
    {
      "timings": {
        "Fajr": "2022-04-03T05:10:00+03:00 (+03)",
        "Sunrise": "2022-04-03T06:45:00+03:00 (+03)",
        "Dhuhr": "2022-04-03T13:07:00+03:00 (+03)",
        "Asr": "2022-04-03T16:43:00+03:00 (+03)",
        "Sunset": "2022-04-03T19:31:00+03:00 (+03)",
        "Maghrib": "2022-04-03T19:31:00+03:00 (+03)",
        "Isha": "2022-04-03T21:00:00+03:00 (+03)",
        "Imsak": "2022-04-03T05:00:00+03:00 (+03)",
        "Midnight": "2022-04-04T01:08:00+03:00 (+03)"
      },
      "date": {
        "readable": "03 Apr 2022",
        "timestamp": "1648965661",
        "gregorian": {
          "date": "03-04-2022",
          "format": "DD-MM-YYYY",
          "day": "03",
          "weekday": {
            "en": "Sunday"
          },
          "month": {
            "number": 4,
            "en": "April"
          },
          "year": "2022",
          "designation": {
            "abbreviated": "AD",
            "expanded": "Anno Domini"
          }
        },
        "hijri": {
          "date": "03-09-1443",
          "format": "DD-MM-YYYY",
          "day": "03",
          "weekday": {
            "en": "Al Ahad",
            "ar": "\u0627\u0644\u0627\u062d\u062f"
          },
          "month": {
            "number": 9,
            "en": "Rama\u1e0d\u0101n",
            "ar": "\u0631\u064e\u0645\u064e\u0636\u0627\u0646"
          },
          "year": "1443",
          "designation": {
            "abbreviated": "AH",
            "expanded": "Anno Hegirae"
          },
          "holidays": []
        }
      },
      "meta": {
        "latitude": 41.017153708870126,
        "longitude": 28.977153766843355,
        "timezone": "Europe\/Istanbul",
        "method": {
          "id": 13,
          "name": "Diyanet \u0130\u015fleri Ba\u015fkanl\u0131\u011f\u0131, Turkey",
          "params": {
            "Fajr": 18,
            "Isha": 17
          },
          "location": {
            "latitude": 39.9333635,
            "longitude": 32.8597419
          }
        },
        "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
        }
      }
    },
//...

When I do adjustment=1, Ramadan 1st is missing from the response, but I'm able to have April 3rd correspond to Ramadan 2nd.

But in any case, ideally I would want the adjustment param to be stable so I can ship the app and not have to upload a new build to change it.

@meezaan
Copy link
Member

meezaan commented Apr 3, 2022

@Roaa94 The Hijri date is is a pure mathematical calculation. The adjustment endpoint is stable (it always does the same thing), it's just not what you are after, and it can't be accomplished the way you want it for complicated reasons (primarily because we cannot mathematically be sure when a month ends or begins in the Islamic calendar and in which country). I'll explain this in more detail in a response later (it may be tomorrow), but to get you going, see the code on https://github.com/islamic-network/aladhan.com/blob/cca09de4a67828ee5636b9dc4ad5fb16bcad0682/routes/ramadan.php#L17. This page generates https://aladhan.com/ramadan-prayer-times/2022/Istanbul/Turkey, for instance.

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

No branches or pull requests

2 participants