diff --git a/lang/belarus/be-latn/holidays.json b/lang/belarus/be-latn/holidays.json new file mode 100644 index 000000000..fda504206 --- /dev/null +++ b/lang/belarus/be-latn/holidays.json @@ -0,0 +1,12 @@ +{ + "Новы год": "Novy hod", + "Новы год (другі дзень)": "Novy hod (druhi dzień)", + "Нараджэнне Хрыстова (праваслаўнае Раство)": "Naradžeńnie Chrystova (pravasłaŭnaje Rastvo)", + "Дзень жанчын": "Dzień žančyn", + "Свята працы": "Sviata pracy", + "Дзень Перамогі": "Dzień Pieramohi", + "Дзень Незалежнасці": "Dzień Niezaležnaści", + "Дзень Кастрычніцкай рэвалюцыі": "Dzień Kastryčnickaj revalucyi", + "Нараджэнне Хрыстова (каталіцкае Раство)": "Naradžeńnie Chrystova (katalickaje Rastvo)", + "Радаўніца": "Radaŭnica" +} diff --git a/lang/belarus/en/holidays.json b/lang/belarus/en/holidays.json new file mode 100644 index 000000000..89c241bcd --- /dev/null +++ b/lang/belarus/en/holidays.json @@ -0,0 +1,12 @@ +{ + "Новы год": "New Year's Day", + "Новы год (другі дзень)": "New Year's Day (second day)", + "Нараджэнне Хрыстова (праваслаўнае Раство)": "Orthodox Christmas", + "Дзень жанчын": "Women's Day", + "Свята працы": "Labor Day", + "Дзень Перамогі": "Victory Day", + "Дзень Незалежнасці": "Independence Day", + "Дзень Кастрычніцкай рэвалюцыі": "October Revolution Day", + "Нараджэнне Хрыстова (каталіцкае Раство)": "Catholic Christmas", + "Радаўніца": "Radaunitsa" +} diff --git a/lang/belarus/ru/holidays.json b/lang/belarus/ru/holidays.json new file mode 100644 index 000000000..266eb0cef --- /dev/null +++ b/lang/belarus/ru/holidays.json @@ -0,0 +1,12 @@ +{ + "Новы год": "Новый год", + "Новы год (другі дзень)": "Новый год (второй день)", + "Нараджэнне Хрыстова (праваслаўнае Раство)": "Православное Рождество", + "Дзень жанчын": "Международный женский день", + "Свята працы": "День труда", + "Дзень Перамогі": "День Победы", + "Дзень Незалежнасці": "День Независимости", + "Дзень Кастрычніцкай рэвалюцыі": "День Октябрьской революции", + "Нараджэнне Хрыстова (каталіцкае Раство)": "Католическое Рождество", + "Радаўніца": "Радуница" +} diff --git a/src/Countries/Belarus.php b/src/Countries/Belarus.php new file mode 100644 index 000000000..f065d714e --- /dev/null +++ b/src/Countries/Belarus.php @@ -0,0 +1,38 @@ + '01-01', + 'Новы год (другі дзень)' => '01-02', + 'Нараджэнне Хрыстова (праваслаўнае Раство)' => '01-07', + 'Дзень жанчын' => '03-08', + 'Свята працы' => '05-01', + 'Дзень Перамогі' => '05-09', + 'Дзень Незалежнасці' => '07-03', + 'Дзень Кастрычніцкай рэвалюцыі' => '11-07', + 'Нараджэнне Хрыстова (каталіцкае Раство)' => '12-25', + ], $this->variableHolidays($year)); + } + + /** @return array */ + protected function variableHolidays(int $year): array + { + $easter = $this->orthodoxEaster($year); + + return [ + 'Радаўніца' => $easter->addDays(9), + ]; + } +} diff --git a/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays.snap b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays.snap new file mode 100644 index 000000000..7f456be80 --- /dev/null +++ b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays.snap @@ -0,0 +1,42 @@ +[ + { + "name": "\u041d\u043e\u0432\u044b \u0433\u043e\u0434", + "date": "2024-01-01" + }, + { + "name": "\u041d\u043e\u0432\u044b \u0433\u043e\u0434 (\u0434\u0440\u0443\u0433\u0456 \u0434\u0437\u0435\u043d\u044c)", + "date": "2024-01-02" + }, + { + "name": "\u041d\u0430\u0440\u0430\u0434\u0436\u044d\u043d\u043d\u0435 \u0425\u0440\u044b\u0441\u0442\u043e\u0432\u0430 (\u043f\u0440\u0430\u0432\u0430\u0441\u043b\u0430\u045e\u043d\u0430\u0435 \u0420\u0430\u0441\u0442\u0432\u043e)", + "date": "2024-01-07" + }, + { + "name": "\u0414\u0437\u0435\u043d\u044c \u0436\u0430\u043d\u0447\u044b\u043d", + "date": "2024-03-08" + }, + { + "name": "\u0421\u0432\u044f\u0442\u0430 \u043f\u0440\u0430\u0446\u044b", + "date": "2024-05-01" + }, + { + "name": "\u0414\u0437\u0435\u043d\u044c \u041f\u0435\u0440\u0430\u043c\u043e\u0433\u0456", + "date": "2024-05-09" + }, + { + "name": "\u0420\u0430\u0434\u0430\u045e\u043d\u0456\u0446\u0430", + "date": "2024-05-14" + }, + { + "name": "\u0414\u0437\u0435\u043d\u044c \u041d\u0435\u0437\u0430\u043b\u0435\u0436\u043d\u0430\u0441\u0446\u0456", + "date": "2024-07-03" + }, + { + "name": "\u0414\u0437\u0435\u043d\u044c \u041a\u0430\u0441\u0442\u0440\u044b\u0447\u043d\u0456\u0446\u043a\u0430\u0439 \u0440\u044d\u0432\u0430\u043b\u044e\u0446\u044b\u0456", + "date": "2024-11-07" + }, + { + "name": "\u041d\u0430\u0440\u0430\u0434\u0436\u044d\u043d\u043d\u0435 \u0425\u0440\u044b\u0441\u0442\u043e\u0432\u0430 (\u043a\u0430\u0442\u0430\u043b\u0456\u0446\u043a\u0430\u0435 \u0420\u0430\u0441\u0442\u0432\u043e)", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Belarus_Lacinka.snap b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Belarus_Lacinka.snap new file mode 100644 index 000000000..3ce0d9150 --- /dev/null +++ b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Belarus_Lacinka.snap @@ -0,0 +1,42 @@ +[ + { + "name": "Novy hod", + "date": "2024-01-01" + }, + { + "name": "Novy hod (druhi dzie\u0144)", + "date": "2024-01-02" + }, + { + "name": "Narad\u017ee\u0144nie Chrystova (pravas\u0142a\u016dnaje Rastvo)", + "date": "2024-01-07" + }, + { + "name": "Dzie\u0144 \u017ean\u010dyn", + "date": "2024-03-08" + }, + { + "name": "Sviata pracy", + "date": "2024-05-01" + }, + { + "name": "Dzie\u0144 Pieramohi", + "date": "2024-05-09" + }, + { + "name": "Rada\u016dnica", + "date": "2024-05-14" + }, + { + "name": "Dzie\u0144 Niezale\u017ena\u015bci", + "date": "2024-07-03" + }, + { + "name": "Dzie\u0144 Kastry\u010dnickaj revalucyi", + "date": "2024-11-07" + }, + { + "name": "Narad\u017ee\u0144nie Chrystova (katalickaje Rastvo)", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_English.snap b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_English.snap new file mode 100644 index 000000000..a57b40011 --- /dev/null +++ b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_English.snap @@ -0,0 +1,42 @@ +[ + { + "name": "New Year's Day", + "date": "2024-01-01" + }, + { + "name": "New Year's Day (second day)", + "date": "2024-01-02" + }, + { + "name": "Orthodox Christmas", + "date": "2024-01-07" + }, + { + "name": "Women's Day", + "date": "2024-03-08" + }, + { + "name": "Labor Day", + "date": "2024-05-01" + }, + { + "name": "Victory Day", + "date": "2024-05-09" + }, + { + "name": "Radaunitsa", + "date": "2024-05-14" + }, + { + "name": "Independence Day", + "date": "2024-07-03" + }, + { + "name": "October Revolution Day", + "date": "2024-11-07" + }, + { + "name": "Catholic Christmas", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Russian.snap b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Russian.snap new file mode 100644 index 000000000..1c93d7360 --- /dev/null +++ b/tests/.pest/snapshots/Countries/BelarusTest/it_can_calculate_belarus_holidays_in_Russian.snap @@ -0,0 +1,42 @@ +[ + { + "name": "\u041d\u043e\u0432\u044b\u0439 \u0433\u043e\u0434", + "date": "2024-01-01" + }, + { + "name": "\u041d\u043e\u0432\u044b\u0439 \u0433\u043e\u0434 (\u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u0435\u043d\u044c)", + "date": "2024-01-02" + }, + { + "name": "\u041f\u0440\u0430\u0432\u043e\u0441\u043b\u0430\u0432\u043d\u043e\u0435 \u0420\u043e\u0436\u0434\u0435\u0441\u0442\u0432\u043e", + "date": "2024-01-07" + }, + { + "name": "\u041c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u0439 \u0436\u0435\u043d\u0441\u043a\u0438\u0439 \u0434\u0435\u043d\u044c", + "date": "2024-03-08" + }, + { + "name": "\u0414\u0435\u043d\u044c \u0442\u0440\u0443\u0434\u0430", + "date": "2024-05-01" + }, + { + "name": "\u0414\u0435\u043d\u044c \u041f\u043e\u0431\u0435\u0434\u044b", + "date": "2024-05-09" + }, + { + "name": "\u0420\u0430\u0434\u0443\u043d\u0438\u0446\u0430", + "date": "2024-05-14" + }, + { + "name": "\u0414\u0435\u043d\u044c \u041d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438", + "date": "2024-07-03" + }, + { + "name": "\u0414\u0435\u043d\u044c \u041e\u043a\u0442\u044f\u0431\u0440\u044c\u0441\u043a\u043e\u0439 \u0440\u0435\u0432\u043e\u043b\u044e\u0446\u0438\u0438", + "date": "2024-11-07" + }, + { + "name": "\u041a\u0430\u0442\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0420\u043e\u0436\u0434\u0435\u0441\u0442\u0432\u043e", + "date": "2024-12-25" + } +] \ No newline at end of file diff --git a/tests/Countries/BelarusTest.php b/tests/Countries/BelarusTest.php new file mode 100644 index 000000000..5fc33f7e7 --- /dev/null +++ b/tests/Countries/BelarusTest.php @@ -0,0 +1,54 @@ +get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); + +it('can calculate belarus holidays in English', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + + $holidays = Holidays::for(country: 'by', locale: 'en')->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); + +it('can calculate belarus holidays in Belarus Lacinka', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + + $holidays = Holidays::for(country: 'by', locale: 'be-latn')->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +}); + +it('can calculate belarus holidays in Russian', function () { + CarbonImmutable::setTestNowAndTimezone('2024-01-01'); + + $holidays = Holidays::for(country: 'by', locale: 'ru')->get(); + + expect($holidays) + ->toBeArray() + ->not()->toBeEmpty(); + + expect(formatDates($holidays))->toMatchSnapshot(); +});