Comments (13)
This is my actual code :
const adhan = require("adhan");
const moment = require("moment");
// Casablanca
const coordinates = new adhan.Coordinates(33.5731,-7.5898);
// Params
const params = adhan.CalculationMethod.Other();
params.fajrAngle = 19;
params.ishaAngle = 17;
params.madhab = adhan.Madhab.Shafi;
getPrayers = date => {
const prayerTimes = new adhan.PrayerTimes(coordinates, date, params);
const result = {};
Object.keys(prayerTimes).forEach(e => {
if (typeof prayerTimes[e] != "function")
result[e] = moment.utc(prayerTimes[e]).format("HH:mm");
});
return result;
};
const monthResult = [];
let tempdate = new Date(2020,4,1)
for (var i = 1; i <= 30; i++) {
const dailyResult = getPrayers(tempdate);
monthResult[moment.utc(tempdate).format("DD_MM")] = dailyResult;
tempdate = moment(tempdate)
.add(1, "days")
.toDate();
}
Object.keys(monthResult).forEach(e=>{
console.log(e, monthResult[e].fajr,monthResult[e].sunrise,monthResult[e].dhuhr,monthResult[e].asr,monthResult[e].maghrib,monthResult[e].isha);
// console.log(`${monthResult[e].isha} - ${monthResult[e].maghrib} - ${monthResult[e].asr} - ${monthResult[e].dhuhr} - ${monthResult[e].sunrise} - ${monthResult[e].fajr} - ${e}`)
})
// console.log(result);
And those are the params I used, based on some research on the internet
// Casablanca
const coordinates = new adhan.Coordinates(33.5731,-7.5898);
// Params
const params = adhan.CalculationMethod.Other();
params.fajrAngle = 19;
params.ishaAngle = 17;
params.madhab = adhan.Madhab.Shafi;
from adhan-js.
This is the actual result :
Day | Fajr | Sunrise | Shuhr | Asr | Maghrib | Ishae |
---|---|---|---|---|---|---|
01/05/2020 | 04:04 | 05:42 | 12:27 | 16:10 | 19:14 | 20:40 |
02/05/2020 | 04:03 | 05:41 | 12:27 | 16:10 | 19:14 | 20:41 |
03/05/2020 | 04:01 | 05:40 | 12:27 | 16:10 | 19:15 | 20:42 |
04/05/2020 | 04:00 | 05:39 | 12:27 | 16:10 | 19:16 | 20:43 |
05/05/2020 | 03:59 | 05:38 | 12:27 | 16:10 | 19:17 | 20:44 |
06/05/2020 | 03:58 | 05:37 | 12:27 | 16:10 | 19:18 | 20:45 |
07/05/2020 | 03:56 | 05:36 | 12:27 | 16:10 | 19:18 | 20:46 |
08/05/2020 | 03:55 | 05:35 | 12:27 | 16:10 | 19:19 | 20:47 |
09/05/2020 | 03:54 | 05:34 | 12:27 | 16:10 | 19:20 | 20:48 |
10/05/2020 | 03:53 | 05:33 | 12:27 | 16:10 | 19:21 | 20:50 |
11/05/2020 | 03:52 | 05:33 | 12:27 | 16:10 | 19:21 | 20:51 |
12/05/2020 | 03:50 | 05:32 | 12:27 | 16:11 | 19:22 | 20:52 |
13/05/2020 | 03:49 | 05:31 | 12:27 | 16:11 | 19:23 | 20:53 |
14/05/2020 | 03:48 | 05:30 | 12:27 | 16:11 | 19:24 | 20:54 |
15/05/2020 | 03:47 | 05:30 | 12:27 | 16:11 | 19:24 | 20:55 |
16/05/2020 | 03:46 | 05:29 | 12:27 | 16:11 | 19:25 | 20:56 |
17/05/2020 | 03:45 | 05:28 | 12:27 | 16:11 | 19:26 | 20:57 |
18/05/2020 | 03:44 | 05:28 | 12:27 | 16:11 | 19:26 | 20:58 |
19/05/2020 | 03:43 | 05:27 | 12:27 | 16:11 | 19:27 | 20:59 |
20/05/2020 | 03:42 | 05:26 | 12:27 | 16:11 | 19:28 | 21:00 |
21/05/2020 | 03:41 | 05:26 | 12:27 | 16:11 | 19:29 | 21:01 |
22/05/2020 | 03:40 | 05:25 | 12:27 | 16:11 | 19:29 | 21:02 |
23/05/2020 | 03:40 | 05:25 | 12:27 | 16:12 | 19:30 | 21:03 |
24/05/2020 | 03:38 | 05:24 | 12:27 | 16:12 | 19:31 | 21:05 |
25/05/2020 | 03:37 | 05:23 | 12:27 | 16:12 | 19:32 | 21:05 |
26/05/2020 | 03:36 | 05:23 | 12:28 | 16:12 | 19:33 | 21:06 |
27/05/2020 | 03:36 | 05:22 | 12:28 | 16:12 | 19:33 | 21:07 |
28/05/2020 | 03:35 | 05:22 | 12:28 | 16:12 | 19:34 | 21:08 |
29/05/2020 | 03:34 | 05:22 | 12:28 | 16:12 | 19:34 | 21:09 |
30/05/2020 | 03:34 | 05:21 | 12:28 | 16:13 | 19:35 | 21:10 |
31/05/2020 | 03:33 | 05:21 | 12:28 | 16:13 | 19:36 | 21:11 |
And this is the expected result:
Day | Fajr | Sunrise | Shuhr | Asr | Maghrib | Ishae |
---|---|---|---|---|---|---|
01/05/2020 | 04:04 | 05:38 | 12:33 | 16:10 | 19:18 | 20:40 |
02/05/2020 | 04:03 | 05:37 | 12:33 | 16:10 | 19:19 | 20:41 |
03/05/2020 | 04:01 | 05:36 | 12:33 | 16:10 | 19:20 | 20:42 |
04/05/2020 | 04:00 | 05:35 | 12:32 | 16:10 | 19:21 | 20:43 |
05/05/2020 | 03:59 | 05:35 | 12:32 | 16:10 | 19:22 | 20:45 |
06/05/2020 | 03:57 | 05:34 | 12:32 | 16:10 | 19:22 | 20:46 |
07/05/2020 | 03:56 | 05:33 | 12:32 | 16:10 | 19:23 | 20:47 |
08/05/2020 | 03:55 | 05:32 | 12:32 | 16:10 | 19:24 | 20:48 |
09/05/2020 | 03:54 | 05:31 | 12:32 | 16:10 | 19:25 | 20:49 |
10/05/2020 | 03:53 | 05:30 | 12:32 | 16:10 | 19:25 | 20:50 |
11/05/2020 | 03:51 | 05:29 | 12:32 | 16:10 | 19:26 | 20:51 |
12/05/2020 | 03:50 | 05:29 | 12:32 | 16:11 | 19:27 | 20:52 |
13/05/2020 | 03:49 | 05:28 | 12:32 | 16:11 | 19:28 | 20:53 |
14/05/2020 | 03:48 | 05:27 | 12:32 | 16:11 | 19:28 | 20:54 |
15/05/2020 | 03:47 | 05:26 | 12:32 | 16:11 | 19:29 | 20:55 |
16/05/2020 | 03:46 | 05:26 | 12:32 | 16:11 | 19:30 | 20:56 |
17/05/2020 | 03:45 | 05:25 | 12:32 | 16:11 | 19:31 | 20:57 |
18/05/2020 | 03:44 | 05:24 | 12:32 | 16:11 | 19:31 | 20:58 |
19/05/2020 | 03:43 | 05:24 | 12:32 | 16:11 | 19:32 | 20:59 |
20/05/2020 | 03:42 | 05:23 | 12:32 | 16:11 | 19:33 | 21:00 |
21/05/2020 | 03:41 | 05:22 | 12:32 | 16:11 | 19:33 | 21:01 |
22/05/2020 | 03:40 | 05:22 | 12:32 | 16:11 | 19:34 | 21:02 |
23/05/2020 | 03:39 | 05:21 | 12:32 | 16:12 | 19:35 | 21:03 |
24/05/2020 | 03:39 | 05:21 | 12:33 | 16:12 | 19:36 | 21:04 |
25/05/2020 | 03:38 | 05:20 | 12:33 | 16:12 | 19:36 | 21:05 |
26/05/2020 | 03:37 | 05:20 | 12:33 | 16:12 | 19:37 | 21:06 |
27/05/2020 | 03:36 | 05:20 | 12:33 | 16:12 | 19:37 | 21:07 |
28/05/2020 | 03:36 | 05:19 | 12:33 | 16:12 | 19:38 | 21:07 |
29/05/2020 | 03:35 | 05:19 | 12:33 | 16:12 | 19:39 | 21:08 |
30/05/2020 | 03:34 | 05:18 | 12:33 | 16:13 | 19:39 | 21:09 |
31/05/2020 | 03:34 | 05:18 | 12:33 | 16:13 | 19:40 | 21:10 |
from adhan-js.
Does anyone have any idea why there are differences ?
from adhan-js.
@kafiil A quick thing to note on the discrepancies. I see you're listing the prayer times for the month of May however when I go to http://www.habous.gov.ma/prieres/index.html I see that it actually goes from April 25 to May 23 (the month of Ramadan). Where did you get the remainder of the month of May?
from adhan-js.
I think we can gather all the prayer times for a full year by using the wayback machine http://web.archive.org/web/20180901000000*/http://www.habous.gov.ma/prieres/index.html
from adhan-js.
@z3bi Thanks for your reply.
I Used this to get the official times http://www.habous.gov.ma/fr/horaire-priere.html
In that page you can select to month (Georgian) you wish to view and the city and you get the data.
Also, and because I never could calculate accurate times I made and api with scrapped data from this website.
You can view it here, it has a swagger that you can use to test it.
You don't need the wayback machine, the api gives you whatever you need, I can provide the data for the whole year, but for any city ?
from adhan-js.
I also made this small react app ( that looks ugly right now ).
If I could calculate the times in Morocco with accuracy, I wouldn't need the api.
from adhan-js.
I Used this to get the official times http://www.habous.gov.ma/fr/horaire-priere.html
In that page you can select to month (Georgian) you wish to view and the city and you get the data.
Thats perfect. So we just need to pick a city (like Marrakesh) and get the prayer times for 1 day of each month and create JSON file following this format https://github.com/batoulapps/adhan-js/blob/master/Shared/Times/Dubai-Gulf.json
That will allow us to recreate the prayer times with accuracy.
from adhan-js.
https://maroc-salat.herokuapp.com/prayer?cityId=80&day=1&lang=fr-fr
This is the data for Marrakech for each first day if the month for the whole year.
I can do some transformation to make it in the required format
from adhan-js.
@z3bi I need your help to complete the JSON,
What I am supposed to put in the source array apart from the url of the official website ?
Please let me know when you're available for a chat.
from adhan-js.
That’s where I generally copy and paste the original times from the website. JSON doesn’t support comments so I made it an array of strings to reference.
from adhan-js.
I am also not. sure about the highLatitudeRule
, I didn't change it in my CalculationMethod.
from adhan-js.
I added the requested file to my branch, it's now part of the pull request.
from adhan-js.
Related Issues (20)
- Prayer Ending Times HOT 1
- Understanding the functionality of nextPrayer and currentPrayer HOT 2
- Moon Phases?
- Wrong time returned HOT 1
- [suggestion]: Use `const enums` for some constant variables
- time difference for asr on Turkey HOT 1
- The use of Temporal HOT 2
- [suggestion]: Add 'Imsak' Timings HOT 4
- Host the javascript on cdnjs or similar HOT 1
- Turkish Diyanet times for Netherlands gives wrong for yatsi time
- Reason for using sth like moment.js HOT 2
- Taking elevation into account for prayer times HOT 1
- Considering elevation for Salah times HOT 21
- TypeError: Cannot read properties of undefined (reading 'getTime') HOT 1
- add adjustment settings to sunset HOT 6
- Prayer times are wrong(?) HOT 16
- The possibility of adjusting the midnight time HOT 1
- Calculation is returning prayer times for next day instead of "today" HOT 3
- Getting Default Calculation Method for Location
- Wrong times HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adhan-js.