The Brazil provider sometimes calculates the wrong Easter date for a given year.
It uses DateTimeImmutable::createFromFormat('U', easter_date($year)) -- which actually returns Saturday for timezones with a positive offset from UTC.
That's because easter_date() returns the UNIX timestamp for midnight on Easter Sunday, but for the current timezone. DateTimeImmutable::createFromFormat always uses UTC if a UNIX timestamp is provided, and for timezones with a positive offset midnight on Easter Sunday is actually Saturday afternoon or evening in UTC.
Accordingly, all Brazilian holidays relative to the Easter date are one day off under these circumstances.
This PR switches the Brazil provider to the AbstractEaster provider implementation which all the other providers are already using.
It also removes a duplicate: 'Carnaval' was defined both as a country-wide holiday and as a holiday for Rio de Janeiro state.
The Brazil provider sometimes calculates the wrong Easter date for a given year.
It uses
DateTimeImmutable::createFromFormat('U', easter_date($year))
-- which actually returns Saturday for timezones with a positive offset from UTC.That's because
easter_date()
returns the UNIX timestamp for midnight on Easter Sunday, but for the current timezone.DateTimeImmutable::createFromFormat
always uses UTC if a UNIX timestamp is provided, and for timezones with a positive offset midnight on Easter Sunday is actually Saturday afternoon or evening in UTC.Accordingly, all Brazilian holidays relative to the Easter date are one day off under these circumstances.
This PR switches the Brazil provider to the
AbstractEaster
provider implementation which all the other providers are already using.It also removes a duplicate: 'Carnaval' was defined both as a country-wide holiday and as a holiday for Rio de Janeiro state.