forked from rickar/cal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
holiday_defs_fr.go
49 lines (44 loc) · 1.3 KB
/
holiday_defs_fr.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
package cal
import "time"
// Holidays in France
var (
FRNouvelAn = NewYear
FRLundiDePâques = EasterMonday
FRFêteDuTravail = ECBLabourDay
FRArmistice1945 = NewHoliday(time.May, 8)
FRJeudiDeLAscension = NewHolidayFunc(calculateJeudiDeLAscension)
FRLundiDePentecôte = NewHolidayFunc(calculateLundiDePentecôte)
FRFêteNationale = NewHoliday(time.July, 14)
FRAssomption = NewHoliday(time.August, 15)
FRToussaint = NewHoliday(time.November, 1)
FRArmistice1918 = NewHoliday(time.November, 11)
FRNoël = Christmas
)
// AddFranceHolidays adds all France holidays to the Calendar
func AddFranceHolidays(c *Calendar) {
c.AddHoliday(
FRNouvelAn,
FRLundiDePâques,
FRFêteDuTravail,
FRArmistice1945,
FRJeudiDeLAscension,
FRLundiDePentecôte,
FRFêteNationale,
FRAssomption,
FRToussaint,
FRArmistice1918,
FRNoël,
)
}
func calculateJeudiDeLAscension(year int, loc *time.Location) (time.Month, int) {
easter := calculateEaster(year, loc)
// 39 days after Easter Sunday
t := easter.AddDate(0, 0, +39)
return t.Month(), t.Day()
}
func calculateLundiDePentecôte(year int, loc *time.Location) (time.Month, int) {
easter := calculateEaster(year, loc)
// 50 days after Easter Sunday
t := easter.AddDate(0, 0, +50)
return t.Month(), t.Day()
}