-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils.go
60 lines (52 loc) · 1.08 KB
/
utils.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
51
52
53
54
55
56
57
58
59
60
package ethiopian_calendar
import "math"
func GetEvangelist(year int) int {
aa := 5500 + year
result := aa % 4
if result == 0 {
return EVANGELIST_JOHN
}
return result
}
func GetRabit(year int) int {
aa := 5500 + year
return int(math.Floor(float64(aa) / 4))
}
func GetWenber(year int) int {
aa := 5500 + year
// TODO: What happens when (aa % 19 == 0)?
if aa % 19 == 0 {
return 18
}
return (aa % 19) - 1
}
func GetMeTq(year int) int {
return (GetWenber(year) * 19) % 30
}
func GetMebacha(year int) int {
aa := 5500 + year
rem := (aa + GetRabit(year)) % 7
return rem + 1
}
func GetMebajaHamer(year int) DayOfYear {
mebacha := GetMebacha(year)
meTq := GetMeTq(year)
meTqMonth := MONTH_MESKEREM
if meTq >= 2 && meTq <= 14 {
meTqMonth = MONTH_TIKIMT
}
meTqDay := ((meTqMonth-1) * 30 + mebacha + meTq - 1) % 7
if meTqDay == 0 {
meTqDay = 7
}
tewsakTable := []int{0, 6, 5, 4, 3, 2, 8, 7}
meTqAndDayTewsak := meTq + tewsakTable[meTqDay]
month := meTqMonth
if meTqAndDayTewsak > 30 {
month += 1
}
return DayOfYear{
Month: month,
Day: meTqAndDayTewsak % 30,
}
}