-
Notifications
You must be signed in to change notification settings - Fork 86
/
example.html
55 lines (45 loc) · 2.68 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
<html>
<head>
<script src="lib/bundles/adhan.umd.min.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";
}
}
const coordinates = new adhan.Coordinates(35.7897507, -78.6912485);
const params = adhan.CalculationMethod.MoonsightingCommittee();
const date = new Date(2022, 3, 20);
var prayerTimes = new adhan.PrayerTimes(coordinates, date, params);
var sunnahTimes = new adhan.SunnahTimes(prayerTimes);
document.write('Raleigh, NC - Moonsighting Committee\n');
document.write(`Prayer times for ${moment(date).format('MMMM DD, YYYY')}\n`);
document.write(`Fajr: ${moment(prayerTimes.fajr).tz('America/New_York').format('MMMM DD, YYYY h:mm A')}\n`);
document.write(`Sunrise: ${moment(prayerTimes.sunrise).tz('America/New_York').format('MMMM DD, YYYY h:mm A')}\n`);
document.write(`Dhuhr: ${moment(prayerTimes.dhuhr).tz('America/New_York').format('MMMM DD, YYYY h:mm A')}\n`);
document.write(`Asr: ${moment(prayerTimes.asr).tz('America/New_York').format('MMMM DD, YYYY h:mm A')}\n`);
document.write(`Maghrib: ${moment(prayerTimes.maghrib).tz('America/New_York').format('MMMM DD, YYYY h:mm A')}\n`);
document.write(`Isha: ${moment(prayerTimes.isha).tz('America/New_York').format('MMMM DD, YYYY h:mm A')}\n`);
document.write(`middle of the night: ${moment(sunnahTimes.middleOfTheNight).tz('America/New_York').format('MMMM DD, YYYY h:mm A')}\n`);
document.write(`last third of the night: ${moment(sunnahTimes.lastThirdOfTheNight).tz('America/New_York').format('MMMM DD, YYYY h:mm A')}\n\n`);
document.write(`Current Prayer: ${prayerName(prayerTimes.currentPrayer())}\n\n`);
document.write(`Qibla Direction: ${adhan.Qibla(coordinates)}`);
</script></pre>
</body>
</html>