What are some potential issues with calculating movable holidays like Easter and Pentecost in PHP functions?

One potential issue with calculating movable holidays like Easter and Pentecost in PHP functions is that these holidays are based on complex algorithms that may vary each year. To accurately calculate these holidays, it's important to use a reliable library or API that provides accurate calculations for these movable holidays.

// Example using the Carbon library to calculate Easter Sunday
use Carbon\Carbon;

function calculateEasterSunday($year) {
    return Carbon::create($year)->setEaster();
}

// Example usage
$easterSunday = calculateEasterSunday(2022);
echo $easterSunday->toDateString(); // Output: 2022-04-17