forked from batoulapps/adhan-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
59 lines (48 loc) · 2.53 KB
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<html>
<head>
<script src="Adhan.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment-with-locales.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.28/moment-timezone-with-data-10-year-range.min.js"></script>
</head>
<body>
<pre><script type="text/javascript">
function prayerName(prayer) {
if (prayer == adhan.Prayer.Fajr) {
return "Fajr";
} else if (prayer == adhan.Prayer.Sunrise) {
return "Sunrise";
} else if (prayer == adhan.Prayer.Dhuhr) {
return "Dhuhr";
} else if (prayer == adhan.Prayer.Asr) {
return "Asr";
} else if (prayer == adhan.Prayer.Maghrib) {
return "Maghrib";
} else if (prayer == adhan.Prayer.Isha) {
return "Isha";
} else if (prayer == adhan.Prayer.None) {
return "None";
}
}
var date = new Date();
var coordinates = new adhan.Coordinates(35.78056, -78.6389);
var params = adhan.CalculationMethod.MuslimWorldLeague();
params.madhab = adhan.Madhab.Hanafi;
var prayerTimes = new adhan.PrayerTimes(coordinates, date, params);
var sunnahTimes = new adhan.SunnahTimes(prayerTimes);
document.write('Raleigh, NC - Muslim World League\n');
document.write(`Prayer times for ${moment(date).format('MMMM DD, YYYY')}\n`);
document.write(`Fajr: ${moment(prayerTimes.fajr).tz('America/New_York').format('h:mm A')}\n`);
document.write(`Sunrise: ${moment(prayerTimes.sunrise).tz('America/New_York').format('h:mm A')}\n`);
document.write(`Dhuhr: ${moment(prayerTimes.dhuhr).tz('America/New_York').format('h:mm A')}\n`);
document.write(`Asr: ${moment(prayerTimes.asr).tz('America/New_York').format('h:mm A')}\n`);
document.write(`Maghrib: ${moment(prayerTimes.maghrib).tz('America/New_York').format('h:mm A')}\n`);
document.write(`Isha: ${moment(prayerTimes.isha).tz('America/New_York').format('h:mm A')}\n`);
document.write(`middle of the night: ${moment(sunnahTimes.middleOfTheNight).tz('America/New_York').format('h:mm A')}\n`);
document.write(`last third of the night: ${moment(sunnahTimes.lastThirdOfTheNight).tz('America/New_York').format('h:mm A')}\n\n`);
document.write(`Current Prayer: ${prayerName(prayerTimes.currentPrayer())}\n\n`);
document.write(`Qibla Direction: ${adhan.Qibla(coordinates)}`);
var nyc = { latitude: 40.7128, longitude: -74.0059 };
expect(qibla(nyc)).toBeCloseTo(58.4817, 3);
</script></pre>
</body>
</html>