batoulapps / adhan-js

High precision Islamic prayer time library for JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

مساعدة في حساب اوقات الصلاة لدولة الجزائر

rn0x opened this issue · comments

commented

السلام عليكم ورحمة الله وبركاته
احاول حساب اوقات الصلاة لولايات الجزائر مثل ولاية ادرار

{
    "city": "Adrar",
    "name": "أدرار",
    "longitude": "27.9763317",
    "latitude": "-0.4841573",
    "timezone": "Africa/Algiers"
}

اتمنى مساعدتي في طريقة حساب اوقات الصلاة
استخدمت

 adhan.CalculationMethod.MuslimWorldLeague()

لاكن التوقيت يأتيني مختلف عن ما أجده في قوقل

const adhan = require('adhan');
const moment = require('moment-timezone');

let dz = {
    "city": "Adrar",
    "name": "أدرار",
    "longitude": "27.9763317",
    "latitude": "-0.4841573",
    "timezone": "Africa/Algiers"
}

let coordinates = new adhan.Coordinates(dz.latitude ,dz.longitude);
let params = adhan.CalculationMethod.MuslimWorldLeague()
let date = new Date();
let prayerTimes = new adhan.PrayerTimes(coordinates, date, params);
let fajr = moment(prayerTimes.fajr).tz(dz.timezone).format('h:mm A');
let sunrise = moment(prayerTimes.sunrise).tz(dz.timezone).format('h:mm A');
let dhuhr = moment(prayerTimes.dhuhr).tz(dz.timezone).format('h:mm A');
let asr = moment(prayerTimes.asr).tz(dz.timezone).format('h:mm A');
let maghrib = moment(prayerTimes.maghrib).tz(dz.timezone).format('h:mm A');
let isha = moment(prayerTimes.isha).tz(dz.timezone).format('h:mm A');


console.log('time now :', moment().tz(dz.timezone).format('h:mm A'));
console.log(`fajr ${fajr}\nsunrise ${sunrise}\ndhuhr ${dhuhr}\nasr ${asr}\nmaghrib ${maghrib}\nisha ${isha}`);

الإخراج

time now : 3:14 PM
fajr 3:59 AM
sunrise 5:12 AM
dhuhr 11:16 AM
asr 2:38 PM
maghrib 5:17 PM
isha 6:26 PM

المتوقع

time now : 3:14 PM
fajr 3:56 AM
sunrise 5:49 AM
dhuhr 12:54 AM
asr 4:44 PM
maghrib 7:59 PM
isha 9:38 PM

لقطة الشاشة_2022-07-27_15-34-23

عليكم السلام و رحمة الله و بركاته,

First of all, you have a big difference because you inversed latitude and longitude.

That should be :

let dz = {
  city: "Adrar",
  name: "أدرار",
  **latitude**: "27.9763317",
  **longitude**: "-0.4841573",
  timezone: "Africa/Algiers"
};

Secondly, there's no precise method to get the exact times because they are adjusted manually by the "Algerian Ministry of Religious Affairs and Wakfs" http://marw.dz/%D9%85%D9%88%D8%A7%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B5%D9%84%D8%A7%D8%A9

image

As you can see in this picture, they are adding different offsets every month, so you will never be able to predict that. It depends on many things, including personal choices, weather, etc..

The same thing happens with JAKIM in Malaysia and many other countries (in the Middle East, almost every country).

My advice: Don't try to get the exact times, you won't be able to. Or, change manually the adjustments in the algorithm and update it every time a new calendar is released by the ministry. If you are only dealing with Algerie that could be a solution for you.

For your information, Muslim Pro application is setting all these offsets manually for almost every country, this is why they are always synchronized with the official times. But not everyone is like Muslim Pro, a big company with many employees.

commented

عليكم السلام و رحمة الله و بركاته,

بادئ ذي بدء ، لديك فرق كبير لأنك قلبت خطوط الطول والعرض.

التي ينبغي أن تكون :

let dz = {
  city: "Adrar",
  name: "أدرار",
  **latitude**: "27.9763317",
  **longitude**: "-0.4841573",
  timezone: "Africa/Algiers"
};

ثانيًا ، لا توجد طريقة دقيقة للحصول على الأوقات الدقيقة لأنه يتم تعديلها يدويًا من قبل "وزارة الشؤون الدينية والأوقاف الجزائرية" http://marw.dz/٪D9٪85٪D9٪88٪D8٪A7٪D9٪ 82٪ D9٪ 8A٪ D8٪ AA-٪ D8٪ A7٪ D9٪ 84٪ D8٪ B5٪ D9٪ 84٪ D8٪ A7٪ D8٪ A9

صورة

كما ترى في هذه الصورة ، فإنهم يضيفون تعويضات مختلفة كل شهر ، لذلك لن تكون قادرًا على التنبؤ بذلك. يعتمد ذلك على أشياء كثيرة ، بما في ذلك الخيارات الشخصية والطقس وما إلى ذلك.

يحدث نفس الشيء مع JAKIM في ماليزيا والعديد من البلدان الأخرى (في الشرق الأوسط ، كل بلد تقريبًا).

نصيحتي: لا تحاول الحصول على الأوقات المحددة ، فلن تتمكن من ذلك. أو قم بتغيير التعديلات يدويًا في الخوارزمية وقم بتحديثها في كل مرة يتم فيها إصدار تقويم جديد من قبل الوزارة. إذا كنت تتعامل فقط مع Algerie ، فقد يكون هذا حلاً لك.

لمعلوماتك ، يقوم تطبيق Muslim Pro بتعيين كل هذه التعويضات يدويًا لكل بلد تقريبًا ، ولهذا السبب تتم مزامنتها دائمًا مع الأوقات الرسمية. لكن ليس الجميع مثل Muslim Pro ، وهي شركة كبيرة بها العديد من الموظفين.

شكرا لك
وجزاك الله خير ❤️🌹