24
24
* Provider for all holidays in Neuchâtel (Switzerland).
25
25
*
26
26
* @link https://en.wikipedia.org/wiki/Canton_of_Neuch%C3%A2tel
27
+ * @link http://rsn.ne.ch/DATA/program/books/RSN2017/20171/htm/94102.htm
28
+ * @link https://www.ne.ch/themes/travail/Pages/jours-feries.aspx
27
29
*/
28
30
class Neuchatel extends Switzerland
29
31
{
@@ -54,15 +56,26 @@ public function initialize(): void
54
56
$ this ->locale ,
55
57
Holiday::TYPE_OTHER
56
58
));
57
- $ this ->addHoliday ($ this ->newYearsDay ($ this ->year , $ this ->timezone , $ this ->locale , Holiday::TYPE_OTHER ));
58
- $ this ->addHoliday ($ this ->christmasDay ($ this ->year , $ this ->timezone , $ this ->locale , Holiday::TYPE_OTHER ));
59
59
$ this ->addHoliday ($ this ->ascensionDay ($ this ->year , $ this ->timezone , $ this ->locale , Holiday::TYPE_OTHER ));
60
60
$ this ->addHoliday ($ this ->easterMonday ($ this ->year , $ this ->timezone , $ this ->locale , Holiday::TYPE_OTHER ));
61
61
$ this ->addHoliday ($ this ->pentecostMonday ($ this ->year , $ this ->timezone , $ this ->locale , Holiday::TYPE_OTHER ));
62
62
63
- $ this ->calculateBerchtoldsTag ();
64
63
$ this ->calculateBettagsMontag ();
65
64
$ this ->calculateInstaurationRepublique ();
65
+
66
+ $ newYearsDay = $ this ->newYearsDay ($ this ->year , $ this ->timezone , $ this ->locale , Holiday::TYPE_OTHER );
67
+ $ this ->addHoliday ($ newYearsDay );
68
+ if ($ newYearsDay ->format ('N ' ) === '7 ' ) {
69
+ // If the New Year's Day is a sunday, the next day is an holiday
70
+ $ this ->calculateJanuary2nd ();
71
+ }
72
+
73
+ $ christmasDay = $ this ->christmasDay ($ this ->year , $ this ->timezone , $ this ->locale , Holiday::TYPE_OTHER );
74
+ $ this ->addHoliday ($ christmasDay );
75
+ if ($ christmasDay ->format ('N ' ) === '7 ' ) {
76
+ // If the Christmas Day is a sunday, the next day is an holiday
77
+ $ this ->calculateDecember26th ();
78
+ }
66
79
}
67
80
68
81
/**
@@ -89,4 +102,48 @@ private function calculateInstaurationRepublique(): void
89
102
));
90
103
}
91
104
}
105
+
106
+ /**
107
+ * January 2nd
108
+ *
109
+ * @throws InvalidDateException
110
+ * @throws \InvalidArgumentException
111
+ * @throws UnknownLocaleException
112
+ * @throws \Exception
113
+ */
114
+ private function calculateJanuary2nd (): void
115
+ {
116
+ $ this ->addHoliday (new Holiday (
117
+ 'january2nd ' ,
118
+ [
119
+ 'en ' => 'January 2nd ' ,
120
+ 'fr ' => '2 janvier ' ,
121
+ ],
122
+ new DateTime ($ this ->year . '-01-02 ' , DateTimeZoneFactory::getDateTimeZone ($ this ->timezone )),
123
+ $ this ->locale ,
124
+ Holiday::TYPE_OTHER
125
+ ));
126
+ }
127
+
128
+ /**
129
+ * December 26th
130
+ *
131
+ * @throws InvalidDateException
132
+ * @throws \InvalidArgumentException
133
+ * @throws UnknownLocaleException
134
+ * @throws \Exception
135
+ */
136
+ private function calculateDecember26th (): void
137
+ {
138
+ $ this ->addHoliday (new Holiday (
139
+ 'december26th ' ,
140
+ [
141
+ 'en ' => 'December 26th ' ,
142
+ 'fr ' => '26 décembre ' ,
143
+ ],
144
+ new DateTime ($ this ->year . '-12-26 ' , DateTimeZoneFactory::getDateTimeZone ($ this ->timezone )),
145
+ $ this ->locale ,
146
+ Holiday::TYPE_OTHER
147
+ ));
148
+ }
92
149
}
0 commit comments