Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public Holidays for Malawi #133

Merged
merged 36 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2cee99c
Added Uganda holidays and Tests
Crawford30 Jan 19, 2024
863fb73
Fixed::Name having ' on it
Crawford30 Jan 19, 2024
ee2f234
Fix styling
freekmurze Jan 19, 2024
ef6911d
Add Venezuela country class and test
ricardomartos Jan 19, 2024
cf9d7bb
Fix styling
freekmurze Jan 19, 2024
36e83fb
Add Macedonian holidays
object505 Jan 19, 2024
a81346f
Added return type
object505 Jan 19, 2024
c777f21
Fix styling
freekmurze Jan 19, 2024
31d6dae
Adding Nicaragua Holidays
calonzolg Jan 18, 2024
6d282e7
fixing return for phpstan
calonzolg Jan 18, 2024
be60114
match utc time
calonzolg Jan 18, 2024
c90301b
add philippine's regular holidays
kndrckjvr Jan 17, 2024
d2a61f1
Adding Full Mexican Holidays
davsaniuv Jan 17, 2024
b7bf6ba
Add Test
davsaniuv Jan 17, 2024
c2e0a68
update test description and remove typo,
davsaniuv Jan 17, 2024
35129f3
remove vscode folder
davsaniuv Jan 17, 2024
e59e867
Delete .vscode directory
davsaniuv Jan 17, 2024
bd3991d
Fix styling
freekmurze Jan 19, 2024
238519b
wip
freekmurze Jan 19, 2024
1f61997
fix test
freekmurze Jan 19, 2024
fa25323
wip
freekmurze Jan 19, 2024
1f3cb29
Fix styling
freekmurze Jan 19, 2024
16b9e70
Add support for Irish public holidays (#44)
marchanlon Jan 19, 2024
ebad8fb
Fix styling
Nielsvanpach Jan 19, 2024
2b79d78
use better easter calculation for Ireland
Nielsvanpach Jan 19, 2024
a4f85ee
use correct dates for nicaragua and venezuela
Nielsvanpach Jan 19, 2024
94a42dc
cleanup
Nielsvanpach Jan 19, 2024
8272ab9
move to baseline
Nielsvanpach Jan 19, 2024
eb5054c
Add support for Croatian public holidays (#45)
mcbuckets Jan 19, 2024
af14fa2
use easter() instead
Nielsvanpach Jan 19, 2024
a799db7
Fix styling
Nielsvanpach Jan 19, 2024
7c234ee
Bolivian holidays (#40)
rats4final Jan 19, 2024
bf040bf
remove unneeded conversion
Nielsvanpach Jan 19, 2024
1cac33f
Add Estonian holidays (#47)
hulkur Jan 19, 2024
5dddb37
Merge branch 'feat/add_uganda_holidays' of https://github.com/Crawfor…
Crawford30 Jan 19, 2024
95ce250
Added Malawi's public holidays
Crawford30 Jan 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/Countries/Malawi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Spatie\Holidays\Countries;

use Carbon\CarbonImmutable;

class Malawi extends Country
{
public function countryCode(): string
{
return 'mw';
}

protected function allHolidays(int $year): array
{
return array_merge([
'New Years Day' => '01-01',
'John Chilembwe Day' => '01-15',
'Martyrs Day' => '03-03',
'Labour Day' => '05-01',
'Kamuzu Day' => '05-14',
'Independence Day' => '07-06',
'Mothers Day' => '10-15',
'Christmas Day' => '12-25',
'Boxing Day' => '12-26',
], $this->variableHolidays($year));
}

/**
* @return array<string, CarbonImmutable>
*/
private function variableHolidays(int $year): array
{
$easter = CarbonImmutable::createFromTimestamp(easter_date($year))->setTimezone('Africa/Nairobi');

return [
'Good Friday' => $easter->subDays(2),
'Easter Monday' => $easter->addDay(),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[
{
"name": "New Years Day",
"date": "2024-01-01"
},
{
"name": "John Chilembwe Day",
"date": "2024-01-15"
},
{
"name": "Martyrs Day",
"date": "2024-03-03"
},
{
"name": "Good Friday",
"date": "2024-03-29"
},
{
"name": "Easter Monday",
"date": "2024-04-01"
},
{
"name": "Labour Day",
"date": "2024-05-01"
},
{
"name": "Kamuzu Day",
"date": "2024-05-14"
},
{
"name": "Independence Day",
"date": "2024-07-06"
},
{
"name": "Mothers Day",
"date": "2024-10-15"
},
{
"name": "Christmas Day",
"date": "2024-12-25"
},
{
"name": "Boxing Day",
"date": "2024-12-26"
}
]
18 changes: 18 additions & 0 deletions tests/Countries/MalawiTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Spatie\Holidays\Tests\Countries;

use Carbon\CarbonImmutable;
use Spatie\Holidays\Holidays;

it('can calculate ugandan holidays', function () {
CarbonImmutable::setTestNowAndTimezone('2024-01-01');

$holidays = Holidays::for(country: 'mw')->get();

expect($holidays)
->toBeArray()
->not()->toBeEmpty();

expect(formatDates($holidays))->toMatchSnapshot();
});