diff --git a/src/Provider/DE.php b/src/Provider/DE.php index db82a53..6fae7cf 100644 --- a/src/Provider/DE.php +++ b/src/Provider/DE.php @@ -37,6 +37,8 @@ public function getHolidaysByYear($year) { $easter = $this->getEasterDates($year); + $repentanceDay = $this->getDayOfRepentance($year); + // 500th anniversay of the Reformation // @see https://de.wikipedia.org/wiki/Reformationstag#Deutschland if (2017 === $year) { @@ -89,10 +91,26 @@ public function getHolidaysByYear($year) self::STATE_NW, self::STATE_RP, self::STATE_SL, + )), + $repentanceDay->format(self::DATE_FORMAT) => $this->createData('Buß- und Bettag', array( + self::STATE_SN )) ); return $holidays; } + /** + * The German day of repentance is the wednesday befor the 23rd of November + * @param int $year + * @return \DateTime + */ + public function getDayOfRepentance($year) + { + $date = new \DateTime($year.'-11-23'); + $date->modify('previous wednesday'); + + return $date; + } + } diff --git a/test/Provider/DETest.php b/test/Provider/DETest.php index cbf0782..96c7205 100644 --- a/test/Provider/DETest.php +++ b/test/Provider/DETest.php @@ -36,7 +36,9 @@ public function dateProvider() array('2017-10-31', DE::STATE_SH, array('name' => 'Reformationstag')), array('2017-10-31', DE::STATE_BB, array('name' => 'Reformationstag')), array('2018-10-31', DE::STATE_SH, null), - array('2018-10-31', DE::STATE_BB, array('name' => 'Reformationstag')), + array('2018-11-21', DE::STATE_BB, null), + array('2018-11-21', DE::STATE_SN, array('name' => 'Buß- und Bettag')), + array('2018-10-31', DE::STATE_SH, null), ); } }