generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-indian-holidays
- Loading branch information
Showing
14 changed files
with
331 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"Nova godina - prvi dan": "New Year - first day", | ||
"Nova godina - drugi dan": "New Year - second day", | ||
"Badnji dan (za pravoslavce)": "Christmas Eve (Orthodox)", | ||
"Božić (za pravoslavce)": "Christmas (Orthodox)", | ||
"Badnji dan (za rimokatolike)": "Christmas Eve (Catholic)", | ||
"Božić (za rimokatolike)": "Christmas (Catholic)", | ||
"Praznik rada - prvi dan": "Labour Day - first day", | ||
"Praznik rada - drugi dan": "Labour Day - second day", | ||
"Veliki petak (za pravoslavce)": "Good Friday (Orthodox)", | ||
"Veliki petak (za rimokatolike)": "Good Friday (Catholic)", | ||
"Vaskrs (za pravoslavce)": "Easter (Orthodox)", | ||
"Vaskrs (za rimokatolike)": "Easter (Catholic)", | ||
"Vaskršnji ponedjeljak (za pravoslavce)": "Easter Monday (Orthodox)", | ||
"Vaskršnji ponedjeljak (za rimokatolike)": "Easter Monday (Catholic)", | ||
|
||
"Dan Republike": "Republic Day", | ||
"Dan pobjede nad fašizmom": "The day of victory over fascism", | ||
"Dan uspostavljanja Opšteg okvirnog sporazuma za mir u BiH": "The day of establishment of the General Framework Agreement for Peace in Bosnia and Herzegovina", | ||
|
||
"Dan nezavisnosti Bosne i Hercegovine": "Independence Day of Bosnia And Herzegovina", | ||
"Dan državnosti Bosne i Hercegovine": "National Day of Bosnia And Herzegovina", | ||
|
||
"Dan uspostavljanja Brčko distrikta": "Day of establishment of Brčko District" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
use Spatie\Holidays\Calendars\ChineseCalendar; | ||
|
||
class Korea extends Country | ||
{ | ||
use ChineseCalendar; | ||
|
||
public function countryCode(): string | ||
{ | ||
return 'kr'; | ||
} | ||
|
||
protected function allHolidays(int $year): array | ||
{ | ||
return array_merge([ | ||
'신정' => '01-01', | ||
'3ㆍ1절' => '03-01', | ||
'어린이날' => '05-05', | ||
'현충일' => '06-06', | ||
'광복절' => '08-15', | ||
'개천절' => '10-03', | ||
'한글날' => '10-09', | ||
'크리스마스' => '12-15', | ||
], $this->variableHolidays($year)); | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function variableHolidays(int $year): array | ||
{ | ||
$this->setChineseCalendarTimezone('Asia/Seoul'); | ||
|
||
return array_merge( | ||
$this->getLunarNewYearHoliday($year), | ||
$this->getLunarBuddhasBirthday($year), | ||
$this->getLunarChuseok($year), | ||
); | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function getLunarNewYearHoliday(int $year): array | ||
{ | ||
$firstOfJanInChineseCalendar = $this->chineseToGregorianDate('01-01', $year); | ||
|
||
return [ | ||
'설날 연휴 1' => $firstOfJanInChineseCalendar->subDay(), | ||
'설날' => $firstOfJanInChineseCalendar, | ||
'설날 연휴 2' => $firstOfJanInChineseCalendar->addDay(), | ||
]; | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function getLunarBuddhasBirthday(int $year): array | ||
{ | ||
$BuddhasBirthdayInChineseCalendar = $this->chineseToGregorianDate('04-08', $year); | ||
|
||
return [ | ||
'부처님 오신날' => $BuddhasBirthdayInChineseCalendar, | ||
]; | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function getLunarChuseok(int $year): array | ||
{ | ||
$chuseokInChineseCalendar = $this->chineseToGregorianDate('08-15', $year); | ||
|
||
return [ | ||
'추석 연휴 1' => $chuseokInChineseCalendar->subDay(), | ||
'추석' => $chuseokInChineseCalendar, | ||
'추석 연휴 2' => $chuseokInChineseCalendar->addDay(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
tests/.pest/snapshots/Countries/KoreaTest/it_can_calculate_korean_holidays.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
[ | ||
{ | ||
"name": "\uc2e0\uc815", | ||
"date": "2024-01-01" | ||
}, | ||
{ | ||
"name": "\uc124\ub0a0 \uc5f0\ud734 1", | ||
"date": "2024-02-09" | ||
}, | ||
{ | ||
"name": "\uc124\ub0a0", | ||
"date": "2024-02-10" | ||
}, | ||
{ | ||
"name": "\uc124\ub0a0 \uc5f0\ud734 2", | ||
"date": "2024-02-11" | ||
}, | ||
{ | ||
"name": "3\u318d1\uc808", | ||
"date": "2024-03-01" | ||
}, | ||
{ | ||
"name": "\uc5b4\ub9b0\uc774\ub0a0", | ||
"date": "2024-05-05" | ||
}, | ||
{ | ||
"name": "\ubd80\ucc98\ub2d8 \uc624\uc2e0\ub0a0", | ||
"date": "2024-05-15" | ||
}, | ||
{ | ||
"name": "\ud604\ucda9\uc77c", | ||
"date": "2024-06-06" | ||
}, | ||
{ | ||
"name": "\uad11\ubcf5\uc808", | ||
"date": "2024-08-15" | ||
}, | ||
{ | ||
"name": "\ucd94\uc11d \uc5f0\ud734 1", | ||
"date": "2024-09-16" | ||
}, | ||
{ | ||
"name": "\ucd94\uc11d", | ||
"date": "2024-09-17" | ||
}, | ||
{ | ||
"name": "\ucd94\uc11d \uc5f0\ud734 2", | ||
"date": "2024-09-18" | ||
}, | ||
{ | ||
"name": "\uac1c\ucc9c\uc808", | ||
"date": "2024-10-03" | ||
}, | ||
{ | ||
"name": "\ud55c\uae00\ub0a0", | ||
"date": "2024-10-09" | ||
}, | ||
{ | ||
"name": "\ud06c\ub9ac\uc2a4\ub9c8\uc2a4", | ||
"date": "2024-12-15" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.