2121use Yasumi \Holiday ;
2222use Yasumi \Provider \Australia ;
2323use Yasumi \Provider \DateTimeZoneFactory ;
24+ use Yasumi \SubstituteHoliday ;
2425
2526/**
2627 * Provider for all holidays in South Australia (Australia).
@@ -33,6 +34,10 @@ class SouthAustralia extends Australia
3334 */
3435 public const ID = 'AU-SA ' ;
3536
37+ private const EASTER_SUNDAY_ESTABLISHMENT_YEAR = 2024 ;
38+
39+ private const PROCLAMATION_DAY_SUBSTITUTE_YEAR = 2024 ;
40+
3641 public string $ timezone = 'Australia/Adelaide ' ;
3742
3843 /**
@@ -48,7 +53,7 @@ public function initialize(): void
4853
4954 $ this ->addHoliday ($ this ->easterSaturday ($ this ->year , $ this ->timezone , $ this ->locale ));
5055
51- if ($ this ->year >= 2024 ) {
56+ if ($ this ->year >= self :: EASTER_SUNDAY_ESTABLISHMENT_YEAR ) {
5257 $ this ->addHoliday ($ this ->easterSunday ($ this ->year , $ this ->timezone , $ this ->locale ));
5358 }
5459
@@ -155,15 +160,9 @@ protected function easterSunday(
155160 */
156161 protected function calculateMonarchsBirthday (): void
157162 {
158- $ name = $ this ->year >= 2023 ? 'King’s Birthday ' : 'Queen’s Birthday ' ;
159-
160- $ this ->addHoliday (new Holiday (
161- 'monarchsBirthday ' ,
162- ['en ' => $ name ],
163- new \DateTime ("second monday of june {$ this ->year }" , DateTimeZoneFactory::getDateTimeZone ($ this ->timezone )),
164- $ this ->locale ,
165- Holiday::TYPE_OFFICIAL
166- ));
163+ $ this ->addMonarchsBirthdayHoliday (
164+ new \DateTime ("second monday of june {$ this ->year }" , DateTimeZoneFactory::getDateTimeZone ($ this ->timezone ))
165+ );
167166 }
168167
169168 /**
@@ -213,6 +212,7 @@ protected function calculateAdelaideCupDay(): void
213212 protected function calculateProclamationDay (): void
214213 {
215214 $ christmasDay = new \DateTime ("{$ this ->year }-12-25 " , DateTimeZoneFactory::getDateTimeZone ($ this ->timezone ));
215+ $ proclamationDay = new \DateTime ("{$ this ->year }-12-26 " , DateTimeZoneFactory::getDateTimeZone ($ this ->timezone ));
216216
217217 $ this ->addHoliday (new Holiday (
218218 'christmasDay ' ,
@@ -222,6 +222,29 @@ protected function calculateProclamationDay(): void
222222 Holiday::TYPE_OFFICIAL
223223 ));
224224
225+ if ($ this ->year >= self ::PROCLAMATION_DAY_SUBSTITUTE_YEAR && 5 === (int ) $ christmasDay ->format ('w ' )) {
226+ $ holiday = new Holiday (
227+ 'proclamationDay ' ,
228+ ['en ' => 'Proclamation Day ' ],
229+ $ proclamationDay ,
230+ $ this ->locale ,
231+ Holiday::TYPE_OFFICIAL
232+ );
233+
234+ $ this ->addHoliday ($ holiday );
235+
236+ $ proclamationDay ->add (new \DateInterval ('P2D ' ));
237+ $ this ->addHoliday (new SubstituteHoliday (
238+ $ holiday ,
239+ [],
240+ $ proclamationDay ,
241+ $ this ->locale ,
242+ Holiday::TYPE_OFFICIAL
243+ ));
244+
245+ return ;
246+ }
247+
225248 switch ($ christmasDay ->format ('w ' )) {
226249 case 0 : // sunday
227250 $ christmasDay ->add (new \DateInterval ('P1D ' ));
0 commit comments