Skip to content

Commit

Permalink
fix: United Kingdom spring bank holiday 2022 (azuyalabs#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvaincombes committed Dec 23, 2021
1 parent f612e46 commit 8355b73
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ to [Semantic Versioning](https://semver.org).

### Added

- United Kingdom spring bank holiday 2022 is moved to the 2nd june, due to the platinum jubilee [\#270](https://github.com/azuyalabs/yasumi/issues/270)
- World Children's Day for Thuringia (Germany) [\#260](https://github.com/azuyalabs/yasumi/issues/260)
- New National Day for Truth and Reconciliation to
Canada [\#257](https://github.com/azuyalabs/yasumi/pull/257) ([Owen V. Gray](https://github.com/adrx))
Expand Down
13 changes: 13 additions & 0 deletions src/Yasumi/Provider/UnitedKingdom.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,19 @@ protected function calculateSpringBankHoliday(): void
return;
}

// Moved to the 2nd June due to the celebration of the Platinum (2022) Jubilee
if (2022 === $this->year) {
$this->addHoliday(new Holiday(
'springBankHoliday',
['en' => 'Spring Bank Holiday'],
new DateTime("$this->year-6-2", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale,
Holiday::TYPE_BANK
));

return;
}

$this->addHoliday(new Holiday(
'springBankHoliday',
['en' => 'Spring Bank Holiday'],
Expand Down
9 changes: 8 additions & 1 deletion tests/UnitedKingdom/SpringBankHolidayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function testHoliday(): void
}

/**
* Tests the holiday exceptions in 2002 and 2012.
* Tests the holiday exceptions in 2002, 2012 and 2022.
*
* @throws ReflectionException
* @throws Exception
Expand All @@ -74,6 +74,13 @@ public function testHolidayException(): void
2012,
new DateTime('2012-6-4', new DateTimeZone(self::TIMEZONE))
);

$this->assertHoliday(
self::REGION,
self::HOLIDAY,
2022,
new DateTime('2022-6-2', new DateTimeZone(self::TIMEZONE))
);
}

/**
Expand Down

0 comments on commit 8355b73

Please sign in to comment.