-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.go
50 lines (45 loc) · 1.36 KB
/
main.go
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
package main
import (
"fmt"
"time"
"github.com/hablullah/go-prayer"
)
func main() {
// Calculate prayer schedule in Jakarta for 2023.
asiaJakarta, _ := time.LoadLocation("Asia/Jakarta")
jakartaSchedules, _ := prayer.Calculate(prayer.Config{
Latitude: -6.14,
Longitude: 106.81,
Timezone: asiaJakarta,
TwilightConvention: prayer.Kemenag(),
AsrConvention: prayer.Shafii,
PreciseToSeconds: true,
}, 2023)
print(jakartaSchedules)
// Calculate prayer schedule in London for 2023.
// Since London in higher latitude, make sure to enable the adapter.
europeLondon, _ := time.LoadLocation("Europe/London")
londonSchedules, _ := prayer.Calculate(prayer.Config{
Latitude: 51.507222,
Longitude: -0.1275,
Timezone: europeLondon,
TwilightConvention: prayer.ISNA(),
AsrConvention: prayer.Shafii,
HighLatitudeAdapter: prayer.NearestLatitude(),
PreciseToSeconds: true,
}, 2023)
print(londonSchedules)
}
func print(schedules []prayer.Schedule) {
for _, s := range schedules {
fmt.Println(
"'"+s.Date+"'",
s.Fajr.Format("'2006-01-02 15:04:05'"),
s.Sunrise.Format("'2006-01-02 15:04:05'"),
s.Zuhr.Format("'2006-01-02 15:04:05'"),
s.Asr.Format("'2006-01-02 15:04:05'"),
s.Maghrib.Format("'2006-01-02 15:04:05'"),
s.Isha.Format("'2006-01-02 15:04:05'"),
)
}
}