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

Remove summer and wintertime #322

Merged
merged 3 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ changes.

### Removed

- Summertime and Wintertime in the Netherlands and Denmark as these can't be reliably established for historical dates and
aren't true holidays in the context of Yasumi. Refer to this [discussion](https://github.com/azuyalabs/yasumi/discussions/321)
for further details and rationale.

## [2.6.0] - 2023-04-27

### Added
Expand Down
10 changes: 0 additions & 10 deletions src/Yasumi/Provider/Denmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ public function initialize(): void
$this->addHoliday($this->christmasEve($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->newYearsEve($this->year, $this->timezone, $this->locale, Holiday::TYPE_OBSERVANCE));
$this->calculateConstitutionDay();

$summerTime = $this->summerTime($this->year, $this->timezone, $this->locale);
if ($summerTime instanceof Holiday) {
$this->addHoliday($summerTime);
}

$winterTime = $this->winterTime($this->year, $this->timezone, $this->locale);
if ($winterTime instanceof Holiday) {
$this->addHoliday($winterTime);
}
}

public function getSources(): array
Expand Down
36 changes: 0 additions & 36 deletions src/Yasumi/Provider/Netherlands.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ public function initialize(): void

// Calculate other holidays
$this->calculateCarnival();
$this->calculateWinterTime();
$this->calculateSummerTime();
$this->calculateStNicholasDay();
$this->calculateHalloween();
$this->calculatePrincesDay();
Expand Down Expand Up @@ -129,40 +127,6 @@ private function calculateCarnival(): void
}
}

/**
* Winter Time.
*
* The beginning of winter time. Winter time is also known as standard time.
*
* @throws \Exception
*
* @see \Yasumi\Provider\CommonHolidays::winterTime()
*/
private function calculateWinterTime(): void
{
$winterTime = $this->winterTime($this->year, $this->timezone, $this->locale);
if ($winterTime instanceof Holiday) {
$this->addHoliday($winterTime);
}
}

/**
* Summer Time.
*
* The beginning of summer time. Summer time is also known as day lights saving time.
*
* @throws \Exception
*
* @see \Yasumi\Provider\CommonHolidays::summerTime()
*/
private function calculateSummerTime(): void
{
$summerTime = $this->summerTime($this->year, $this->timezone, $this->locale);
if ($summerTime instanceof Holiday) {
$this->addHoliday($summerTime);
}
}

/**
* St. Nicholas' Day.
*
Expand Down
18 changes: 6 additions & 12 deletions tests/Base/HolidayBetweenFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function testHolidaysBetweenDateRange(): void

self::assertArrayHasKey('goodFriday', $betweenHolidays);
self::assertArrayHasKey('easter', $betweenHolidays);
self::assertArrayHasKey('summerTime', $betweenHolidays);
self::assertArrayHasKey('easterMonday', $betweenHolidays);
self::assertArrayHasKey('kingsDay', $betweenHolidays);
self::assertArrayHasKey('internationalWorkersDay', $betweenHolidays);
Expand All @@ -58,17 +57,16 @@ public function testHolidaysBetweenDateRange(): void
self::assertArrayNotHasKey('valentinesDay', $betweenHolidays);
self::assertArrayNotHasKey('princesDay', $betweenHolidays);
self::assertArrayNotHasKey('worldAnimalDay', $betweenHolidays);
self::assertArrayNotHasKey('winterTime', $betweenHolidays);
self::assertArrayNotHasKey('halloween', $betweenHolidays);
self::assertArrayNotHasKey('stMartinsDay', $betweenHolidays);
self::assertArrayNotHasKey('stNicholasDay', $betweenHolidays);
self::assertArrayNotHasKey('christmasDay', $betweenHolidays);
self::assertArrayNotHasKey('secondChristmasDay', $betweenHolidays);

self::assertCount(13, $between);
self::assertCount(12, $between);
self::assertNotCount(\count($holidays), $between);

self::assertEquals(13, $between->count());
self::assertEquals(12, $between->count());
self::assertNotEquals(\count($holidays), $between->count());
}

Expand All @@ -87,7 +85,6 @@ public function testHolidaysBetweenDateRangeWithDateTimeImmutable(): void

self::assertArrayHasKey('goodFriday', $betweenHolidays);
self::assertArrayHasKey('easter', $betweenHolidays);
self::assertArrayHasKey('summerTime', $betweenHolidays);
self::assertArrayHasKey('easterMonday', $betweenHolidays);
self::assertArrayHasKey('kingsDay', $betweenHolidays);
self::assertArrayHasKey('internationalWorkersDay', $betweenHolidays);
Expand All @@ -108,17 +105,16 @@ public function testHolidaysBetweenDateRangeWithDateTimeImmutable(): void
self::assertArrayNotHasKey('valentinesDay', $betweenHolidays);
self::assertArrayNotHasKey('princesDay', $betweenHolidays);
self::assertArrayNotHasKey('worldAnimalDay', $betweenHolidays);
self::assertArrayNotHasKey('winterTime', $betweenHolidays);
self::assertArrayNotHasKey('halloween', $betweenHolidays);
self::assertArrayNotHasKey('stMartinsDay', $betweenHolidays);
self::assertArrayNotHasKey('stNicholasDay', $betweenHolidays);
self::assertArrayNotHasKey('christmasDay', $betweenHolidays);
self::assertArrayNotHasKey('secondChristmasDay', $betweenHolidays);

self::assertCount(13, $between);
self::assertCount(12, $between);
self::assertNotCount(\count($holidays), $between);

self::assertEquals(13, $between->count());
self::assertEquals(12, $between->count());
self::assertNotEquals(\count($holidays), $between->count());
}

Expand Down Expand Up @@ -166,7 +162,6 @@ public function testHolidaysBetweenDateRangeExclusiveStartEndDate(): void
self::assertArrayHasKey('valentinesDay', $betweenHolidays);
self::assertArrayHasKey('goodFriday', $betweenHolidays);
self::assertArrayHasKey('easter', $betweenHolidays);
self::assertArrayHasKey('summerTime', $betweenHolidays);
self::assertArrayHasKey('easterMonday', $betweenHolidays);
self::assertArrayHasKey('kingsDay', $betweenHolidays);
self::assertArrayHasKey('internationalWorkersDay', $betweenHolidays);
Expand All @@ -181,17 +176,16 @@ public function testHolidaysBetweenDateRangeExclusiveStartEndDate(): void
self::assertArrayNotHasKey('newYearsDay', $betweenHolidays);
self::assertArrayNotHasKey('princesDay', $betweenHolidays);
self::assertArrayNotHasKey('worldAnimalDay', $betweenHolidays);
self::assertArrayNotHasKey('winterTime', $betweenHolidays);
self::assertArrayNotHasKey('halloween', $betweenHolidays);
self::assertArrayNotHasKey('stMartinsDay', $betweenHolidays);
self::assertArrayNotHasKey('stNicholasDay', $betweenHolidays);
self::assertArrayNotHasKey('christmasDay', $betweenHolidays);
self::assertArrayNotHasKey('secondChristmasDay', $betweenHolidays);

self::assertCount(19, $between);
self::assertCount(18, $between);
self::assertNotCount(\count($holidays), $between);

self::assertEquals(19, $between->count());
self::assertEquals(18, $between->count());
self::assertNotEquals(\count($holidays), $between->count());
}

Expand Down
8 changes: 2 additions & 6 deletions tests/Base/HolidayFiltersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ public function testSeasonalHolidaysFilter(): void
$filteredHolidaysArray = iterator_to_array($filteredHolidays);

// Assert array definitions
self::assertArrayHasKey('summerTime', $filteredHolidaysArray);
self::assertArrayHasKey('winterTime', $filteredHolidaysArray);
self::assertArrayNotHasKey('newYearsDay', $filteredHolidaysArray);
self::assertArrayNotHasKey('easter', $filteredHolidaysArray);
self::assertArrayNotHasKey('easterMonday', $filteredHolidaysArray);
Expand Down Expand Up @@ -155,9 +153,9 @@ public function testSeasonalHolidaysFilter(): void
self::assertArrayNotHasKey('princesDay', $filteredHolidaysArray);

// Assert number of results returned
self::assertCount(2, $filteredHolidays);
self::assertCount(0, $filteredHolidays);
self::assertNotCount(\count($holidays), $filteredHolidays);
self::assertEquals(2, $filteredHolidays->count());
self::assertEquals(0, $filteredHolidays->count());
self::assertNotEquals(\count($holidays), $filteredHolidays->count());
}

Expand All @@ -176,8 +174,6 @@ public function testOtherHolidaysFilter(): void
self::assertArrayHasKey('mothersDay', $filteredHolidaysArray);
self::assertArrayHasKey('epiphany', $filteredHolidaysArray);
self::assertArrayHasKey('princesDay', $filteredHolidaysArray);
self::assertArrayNotHasKey('summerTime', $filteredHolidaysArray);
self::assertArrayNotHasKey('winterTime', $filteredHolidaysArray);
self::assertArrayNotHasKey('newYearsDay', $filteredHolidaysArray);
self::assertArrayNotHasKey('easter', $filteredHolidaysArray);
self::assertArrayNotHasKey('easterMonday', $filteredHolidaysArray);
Expand Down
6 changes: 0 additions & 6 deletions tests/Base/HolidayOnFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public function testHolidaysOnDate(): void
$holidayDates = [
'goodFriday' => new \DateTime('03/25/2016', new \DateTimeZone($timezone)),
'easter' => new \DateTime('03/27/2016', new \DateTimeZone($timezone)),
'summerTime' => new \DateTime('03/27/2016', new \DateTimeZone($timezone)),
];

foreach ($holidayDates as $name => $date) {
Expand All @@ -52,7 +51,6 @@ public function testHolidaysNotOnDate(): void
$holidayWrongDates = [
'goodFriday' => new \DateTime('04/25/2016', new \DateTimeZone($timezone)),
'easter' => new \DateTime('03/22/2016', new \DateTimeZone($timezone)),
'summerTime' => new \DateTime('12/27/2016', new \DateTimeZone($timezone)),
];

foreach ($holidayWrongDates as $name => $date) {
Expand All @@ -77,9 +75,5 @@ public function testCorrectNumberOfHolidaysOnDate(): void
// One holiday
$holidaysOnDate = $holidays->on(new \DateTime('12/25/2016', new \DateTimeZone($timezone)));
self::assertEquals(1, $holidaysOnDate->count());

// Multiple holidays
$holidaysOnDate = $holidays->on(new \DateTime('03/27/2016', new \DateTimeZone($timezone)));
self::assertGreaterThan(1, $holidaysOnDate->count());
}
}
11 changes: 0 additions & 11 deletions tests/Denmark/DenmarkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,6 @@ public function testObservedHolidays(): void
], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE);
}

/**
* Tests if all seasonal holidays in Denmark are defined by the provider class.
*
* @throws \Exception
*/
public function testSeasonalHolidays(): void
{
$year = $this->generateRandomYear(1980, 2037);
$this->assertDefinedHolidays(['summerTime', 'winterTime'], self::REGION, $year, Holiday::TYPE_SEASON);
}

/**
* Tests if all bank holidays in Denmark are defined by the provider class.
*/
Expand Down
127 changes: 0 additions & 127 deletions tests/Denmark/SummerTimeTest.php

This file was deleted.

Loading