Skip to content

Commit

Permalink
Merge pull request #47 from AngelinCalu/patch-3
Browse files Browse the repository at this point in the history
Refactored the calculation of Orthodox Easter using the function from ChristianHolidays.php.
  • Loading branch information
stelgenhof committed Dec 14, 2016
2 parents 0e8aa47 + b25b2d9 commit c07cbfa
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions src/Yasumi/Provider/Greece.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,27 +91,16 @@ public function calculateCleanMonday()
}

/**
* Calculate the Easter date for Orthodox churches.
* Orthodox Easter
*
* @param int $year
* @param string $timezone
*
* @param int $year the year for which Easter needs to be calculated
* @param string $timezone the timezone in which Easter is celebrated
*
* @return \Datetime date of Orthodox Easter
*
* @link http://php.net/manual/en/function.easter-date.php#83794
* @link https://en.wikipedia.org/wiki/Computus#Adaptation_for_Western_Easter_of_Meeus.27_Julian_algorithm
* @return \Datetime
*/
public function calculateEaster($year, $timezone)
{
$a = $year % 4;
$b = $year % 7;
$c = $year % 19;
$d = (19 * $c + 15) % 30;
$e = (2 * $a + 4 * $b - $d + 34) % 7;
$month = floor(($d + $e + 114) / 31);
$day = (($d + $e + 114) % 31) + 1;

return (new DateTime("$year-$month-$day", new DateTimeZone($timezone)))->add(new DateInterval('P13D'));
return $this->calculateOrthodoxEaster($year, $timezone);
}

/*
Expand Down

0 comments on commit c07cbfa

Please sign in to comment.