batoulapps / adhan-js

High precision Islamic prayer time library for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calculation is returning prayer times for next day instead of "today"

xsorifc28 opened this issue · comments

I am trying to calculate prayer times for Chatham Islands, New Zealand (testing some extreme cases)

Input date is January 6, 2024 - 2024-01-06T00:00:00.000Z.

Here is the output:

{
   "coordinates":{
      "latitude":-43.81498724905606,
      "longitude":-176.70889987599134
   },
   "date":"2024-01-06T00:00:00.000Z",
   "calculationParameters":{
      "madhab":"shafi",
      "highLatitudeRule":"middleofthenight",
      "adjustments":{
         "fajr":0,
         "sunrise":0,
         "dhuhr":0,
         "asr":0,
         "maghrib":0,
         "isha":0
      },
      "methodAdjustments":{
         "fajr":0,
         "sunrise":-7,
         "dhuhr":5,
         "asr":4,
         "maghrib":7,
         "isha":0
      },
      "polarCircleResolution":"Unresolved",
      "rounding":"nearest",
      "shafaq":"general",
      "method":"Turkey",
      "fajrAngle":18,
      "ishaAngle":17,
      "ishaInterval":0,
      "maghribAngle":0
   },
   "fajr":"2024-01-06T13:55:00.000Z",
   "sunrise":"2024-01-06T16:06:00.000Z",
   "dhuhr":"2024-01-06T23:58:00.000Z",
   "asr":"2024-01-07T04:02:00.000Z",
   "sunset":"2024-01-07T07:32:00.000Z",
   "maghrib":"2024-01-07T07:39:00.000Z",
   "isha":"2024-01-07T09:39:00.000Z"
}

When converting the prayer times to the local (CHADT) time zones, the results show that the prayer times are for January 7, 2024.

    Fajr:     01/07/2024, 03:40 GMT+13:45
    Sunrirse: 01/07/2024, 05:51 GMT+13:45
    Dhuhr:    01/07/2024, 13:43 GMT+13:45
    Asr:      01/07/2024, 17:47 GMT+13:45
    Sunset:   01/07/2024, 21:17 GMT+13:45
    Maghrib:  01/07/2024, 21:24 GMT+13:45
    Isha:     01/07/2024, 23:24 GMT+13:45

I can't tell whether the times were calculated for January 6, but the time zone conversion is shifting by one day, or, if the times were calculated for January 7.

Am I misunderstanding or is there an issue with the calculation?

Reopen?