Summary
Ecuador is missing from Yasumi's list of supported countries. This issue proposes adding a full Ecuador holiday provider covering all 12 official public holidays established by the Ecuadorian Labor Code (Código del Trabajo, Art. 65), along with translations and unit tests.
Country details
| Field |
Value |
| ISO 3166-1 alpha-2 |
EC |
| Timezone |
America/Guayaquil |
| Default locale |
es_EC |
| Total public holidays |
12 |
| Legal source |
Código del Trabajo, Art. 65 |
Note: Ecuador observes All Souls' Day (Nov 2), not All Saints' Day (Nov 1).
Carnival is unique in that both Monday and Tuesday are full official holidays.
Proposed implementation
src/Yasumi/Provider/Ecuador.php
<?php
declare(strict_types = 1);
namespace Yasumi\Provider;
use Yasumi\Exception\UnknownLocaleException;
use Yasumi\Holiday;
/**
-
Provider for all holidays in Ecuador.
-
Ecuador observes 12 public holidays established by the Labor Code (Art. 65).
@see https://en.wikipedia.org/wiki/Public_holidays_in_Ecuador
*/
class Ecuador extends AbstractProvider
{
use CommonHolidays;
use ChristianHolidays;
public const INDEPENDENCE_YEAR = 1809;
public const ID = 'EC';
/**
-
@throws \InvalidArgumentException
-
@throws UnknownLocaleException
-
@throws \Exception
*/
public function initialize(): void
{
$this->timezone = 'America/Guayaquil';
$this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->internationalWorkersDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->maundyThursday($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale));
$this->addCarnivalMonday();
$this->addCarnivalTuesday();
$this->addBattleOfPichinchaDay();
$this->addFirstCryOfIndependenceDay();
$this->addGuayaquilIndependenceDay();
$this->addAllSoulsDay();
$this->addFoundationOfQuitoDay();
}
public function getSources(): array
{
return [
'https://en.wikipedia.org/wiki/Public_holidays_in_Ecuador',
'https://www.trabajo.gob.ec/',
];
}
/**
- Carnival Monday — Easter − 48 days.
- Ecuador celebrates both Monday and Tuesday of Carnival week as full holidays.
*/
protected function addCarnivalMonday(): void
{
$date = (clone $this->calculateEaster($this->year, $this->timezone))->sub(new \DateInterval('P48D'));
$this->addHoliday(new Holiday('carnivalMonday',
['en' => 'Carnival Monday', 'es' => 'Lunes de Carnaval'],
$date, $this->locale));
}
/** Carnival Tuesday — Easter − 47 days. */
protected function addCarnivalTuesday(): void
{
$date = (clone $this->calculateEaster($this->year, $this->timezone))->sub(new \DateInterval('P47D'));
$this->addHoliday(new Holiday('carnivalTuesday',
['en' => 'Carnival Tuesday', 'es' => 'Martes de Carnaval'],
$date, $this->locale));
}
/**
- Battle of Pichincha Day — May 24 (since 1822).
- Decisive battle that sealed Ecuador's independence from Spain.
- @see https://en.wikipedia.org/wiki/Battle_of_Pichincha
*/
protected function addBattleOfPichinchaDay(): void
{
if ($this->year >= 1822) {
$this->addHoliday(new Holiday('battleOfPichinchaDay',
['en' => 'Battle of Pichincha Day', 'es' => 'Batalla del Pichincha'],
new \DateTime("{$this->year}-05-24", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
}
/**
- First Cry of Independence — August 10 (since 1809).
- Ecuador's national day; first uprising against Spanish colonial rule.
- @see https://en.wikipedia.org/wiki/Primer_Grito_de_Independencia
*/
protected function addFirstCryOfIndependenceDay(): void
{
if ($this->year >= self::INDEPENDENCE_YEAR) {
$this->addHoliday(new Holiday('firstCryOfIndependenceDay',
['en' => 'First Cry of Independence', 'es' => 'Primer Grito de Independencia'],
new \DateTime("{$this->year}-08-10", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
}
/**
- Independence of Guayaquil — October 9 (since 1820).
- @see https://en.wikipedia.org/wiki/Guayaquil
*/
protected function addGuayaquilIndependenceDay(): void
{
if ($this->year >= 1820) {
$this->addHoliday(new Holiday('guayaquilIndependenceDay',
['en' => 'Independence of Guayaquil', 'es' => 'Independencia de Guayaquil'],
new \DateTime("{$this->year}-10-09", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
}
/**
- All Souls' Day — November 2.
- Ecuador observes All Souls' Day (Nov 2), not All Saints' Day (Nov 1).
*/
protected function addAllSoulsDay(): void
{
$this->addHoliday(new Holiday('allSoulsDay',
['en' => "All Souls' Day", 'es' => 'Día de los Difuntos'],
new \DateTime("{$this->year}-11-02", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
/**
- Foundation of Quito Day — December 6 (since 1534).
@see https://en.wikipedia.org/wiki/Quito
*/
protected function addFoundationOfQuitoDay(): void
{
if ($this->year >= 1534) {
$this->addHoliday(new Holiday('foundationOfQuitoDay',
['en' => 'Foundation of Quito', 'es' => 'Fundación de Quito'],
new \DateTime("{$this->year}-12-06", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
}
}
New translation files
src/Yasumi/data/translations/carnivalMonday.php
<?php declare(strict_types = 1);
return ['en' => 'Carnival Monday', 'es' => 'Lunes de Carnaval', 'pt' => 'Segunda-feira de Carnaval'];
src/Yasumi/data/translations/carnivalTuesday.php
<?php declare(strict_types = 1);
return ['en' => 'Carnival Tuesday', 'es' => 'Martes de Carnaval', 'pt' => 'Terça-feira de Carnaval'];
src/Yasumi/data/translations/battleOfPichinchaDay.php
<?php declare(strict_types = 1);
return ['en' => 'Battle of Pichincha Day', 'es' => 'Batalla del Pichincha'];
src/Yasumi/data/translations/firstCryOfIndependenceDay.php
<?php declare(strict_types = 1);
return ['en' => 'First Cry of Independence', 'es' => 'Primer Grito de Independencia'];
src/Yasumi/data/translations/guayaquilIndependenceDay.php
<?php declare(strict_types = 1);
return ['en' => 'Independence of Guayaquil', 'es' => 'Independencia de Guayaquil'];
src/Yasumi/data/translations/foundationOfQuitoDay.php
<?php declare(strict_types = 1);
return ['en' => 'Foundation of Quito', 'es' => 'Fundación de Quito'];
carnivalMonday and carnivalTuesday are also used by Venezuela — a single pair of translation files covers both providers.
tests/Ecuador/EcuadorBaseTestCase.php
<?php
declare(strict_types = 1);
namespace Yasumi\Tests\Ecuador;
use PHPUnit\Framework\TestCase;
use Yasumi\Tests\YasumiBase;
abstract class EcuadorBaseTestCase extends TestCase
{
use YasumiBase;
public const REGION = 'Ecuador';
public const TIMEZONE = 'America/Guayaquil';
public const LOCALE = 'es_EC';
public const TOTAL_HOLIDAYS = 12;
}
tests/Ecuador/EcuadorTest.php
<?php
declare(strict_types = 1);
namespace Yasumi\Tests\Ecuador;
use PHPUnit\Framework\Attributes\DataProvider;
use Yasumi\Tests\HolidayTestInterface;
use Yasumi\Yasumi;
class EcuadorTest extends EcuadorBaseTestCase implements HolidayTestInterface
{
public function testTotalHolidays(): void
{
$this->assertCount(self::TOTAL_HOLIDAYS, Yasumi::create(self::REGION, 2025));
}
public function testCountryCode(): void
{
$this->assertEquals('EC', Yasumi::create(self::REGION, 2025)->getCountry());
}
#[DataProvider('carnivalMondayDataProvider')]
public function testCarnivalMonday(int $year, \DateTime $expected): void
{
$this->assertHoliday(self::REGION, 'carnivalMonday', $year, $expected);
}
public static function carnivalMondayDataProvider(): array
{
return [
[2023, new \DateTime('2023-02-20', new \DateTimeZone(self::TIMEZONE))],
[2024, new \DateTime('2024-02-12', new \DateTimeZone(self::TIMEZONE))],
[2025, new \DateTime('2025-03-03', new \DateTimeZone(self::TIMEZONE))],
];
}
#[DataProvider('carnivalTuesdayDataProvider')]
public function testCarnivalTuesday(int $year, \DateTime $expected): void
{
$this->assertHoliday(self::REGION, 'carnivalTuesday', $year, $expected);
}
public static function carnivalTuesdayDataProvider(): array
{
return [
[2023, new \DateTime('2023-02-21', new \DateTimeZone(self::TIMEZONE))],
[2024, new \DateTime('2024-02-13', new \DateTimeZone(self::TIMEZONE))],
[2025, new \DateTime('2025-03-04', new \DateTimeZone(self::TIMEZONE))],
];
}
#[DataProvider('battleOfPichinchaDataProvider')]
public function testBattleOfPichinchaDay(int $year, \DateTime $expected): void
{
$this->assertHoliday(self::REGION, 'battleOfPichinchaDay', $year, $expected);
}
public static function battleOfPichinchaDataProvider(): array
{
return [
[2023, new \DateTime('2023-05-24', new \DateTimeZone(self::TIMEZONE))],
[2024, new \DateTime('2024-05-24', new \DateTimeZone(self::TIMEZONE))],
[2025, new \DateTime('2025-05-24', new \DateTimeZone(self::TIMEZONE))],
];
}
#[DataProvider('firstCryDataProvider')]
public function testFirstCryOfIndependenceDay(int $year, \DateTime $expected): void
{
$this->assertHoliday(self::REGION, 'firstCryOfIndependenceDay', $year, $expected);
}
public static function firstCryDataProvider(): array
{
return [
[2023, new \DateTime('2023-08-10', new \DateTimeZone(self::TIMEZONE))],
[2024, new \DateTime('2024-08-10', new \DateTimeZone(self::TIMEZONE))],
[2025, new \DateTime('2025-08-10', new \DateTimeZone(self::TIMEZONE))],
];
}
public function testFirstCryOfIndependenceDayBeforeEstablishment(): void
{
$this->assertNotHoliday(self::REGION, 'firstCryOfIndependenceDay', 1808);
}
#[DataProvider('guayaquilIndependenceDataProvider')]
public function testGuayaquilIndependenceDay(int $year, \DateTime $expected): void
{
$this->assertHoliday(self::REGION, 'guayaquilIndependenceDay', $year, $expected);
}
public static function guayaquilIndependenceDataProvider(): array
{
return [
[2023, new \DateTime('2023-10-09', new \DateTimeZone(self::TIMEZONE))],
[2024, new \DateTime('2024-10-09', new \DateTimeZone(self::TIMEZONE))],
[2025, new \DateTime('2025-10-09', new \DateTimeZone(self::TIMEZONE))],
];
}
}
References
# Add Holiday Provider for Ecuador 🇪🇨
Summary
Ecuador is missing from Yasumi's list of supported countries. This issue proposes adding a full Ecuador holiday provider covering all 12 official public holidays established by the Ecuadorian Labor Code (Código del Trabajo, Art. 65), along with translations and unit tests.
Country details
| Field |
Value |
| ISO 3166-1 alpha-2 |
EC |
| Timezone |
America/Guayaquil |
| Default locale |
es_EC |
| Total public holidays |
12 |
| Legal source |
Código del Trabajo, Art. 65 |
Complete holiday list
| Key |
Name (es) |
Name (en) |
Date |
Type |
Since |
newYearsDay |
Año Nuevo |
New Year's Day |
Jan 1 |
Official |
— |
carnivalMonday |
Lunes de Carnaval |
Carnival Monday |
Easter − 48d |
Official |
— |
carnivalTuesday |
Martes de Carnaval |
Carnival Tuesday |
Easter − 47d |
Official |
— |
maundyThursday |
Jueves Santo |
Maundy Thursday |
Easter − 3d |
Official |
— |
goodFriday |
Viernes Santo |
Good Friday |
Easter − 2d |
Official |
— |
battleOfPichinchaDay |
Batalla del Pichincha |
Battle of Pichincha Day |
May 24 |
Official |
1822 |
internationalWorkersDay |
Día del Trabajo |
International Workers' Day |
May 1 |
Official |
— |
firstCryOfIndependenceDay |
Primer Grito de Independencia |
First Cry of Independence |
Aug 10 |
Official |
1809 |
guayaquilIndependenceDay |
Independencia de Guayaquil |
Independence of Guayaquil |
Oct 9 |
Official |
1820 |
allSoulsDay |
Día de los Difuntos |
All Souls' Day |
Nov 2 |
Official |
— |
foundationOfQuitoDay |
Fundación de Quito |
Foundation of Quito Day |
Dec 6 |
Official |
1534 |
christmasDay |
Navidad |
Christmas Day |
Dec 25 |
Official |
— |
Note: Ecuador observes All Souls' Day (Nov 2), not All Saints' Day (Nov 1).
Carnival is unique in that both Monday and Tuesday are full official holidays.
Proposed implementation
src/Yasumi/Provider/Ecuador.php
<?php
declare(strict_types = 1);
namespace Yasumi\Provider;
use Yasumi\Exception\UnknownLocaleException;
use Yasumi\Holiday;
/**
* Provider for all holidays in Ecuador.
*
* Ecuador observes 12 public holidays established by the Labor Code (Art. 65).
*
* @see https://en.wikipedia.org/wiki/Public_holidays_in_Ecuador
*/
class Ecuador extends AbstractProvider
{
use CommonHolidays;
use ChristianHolidays;
public const INDEPENDENCE_YEAR = 1809;
public const ID = 'EC';
/**
* @throws \InvalidArgumentException
* @throws UnknownLocaleException
* @throws \Exception
*/
public function initialize(): void
{
$this->timezone = 'America/Guayaquil';
$this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->internationalWorkersDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->maundyThursday($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale));
$this->addCarnivalMonday();
$this->addCarnivalTuesday();
$this->addBattleOfPichinchaDay();
$this->addFirstCryOfIndependenceDay();
$this->addGuayaquilIndependenceDay();
$this->addAllSoulsDay();
$this->addFoundationOfQuitoDay();
}
public function getSources(): array
{
return [
'https://en.wikipedia.org/wiki/Public_holidays_in_Ecuador',
'https://www.trabajo.gob.ec/',
];
}
/**
* Carnival Monday — Easter − 48 days.
* Ecuador celebrates both Monday and Tuesday of Carnival week as full holidays.
*/
protected function addCarnivalMonday(): void
{
$date = (clone $this->calculateEaster($this->year, $this->timezone))->sub(new \DateInterval('P48D'));
$this->addHoliday(new Holiday('carnivalMonday',
['en' => 'Carnival Monday', 'es' => 'Lunes de Carnaval'],
$date, $this->locale));
}
/** Carnival Tuesday — Easter − 47 days. */
protected function addCarnivalTuesday(): void
{
$date = (clone $this->calculateEaster($this->year, $this->timezone))->sub(new \DateInterval('P47D'));
$this->addHoliday(new Holiday('carnivalTuesday',
['en' => 'Carnival Tuesday', 'es' => 'Martes de Carnaval'],
$date, $this->locale));
}
/**
* Battle of Pichincha Day — May 24 (since 1822).
*
* Decisive battle that sealed Ecuador's independence from Spain.
*
* @see https://en.wikipedia.org/wiki/Battle_of_Pichincha
*/
protected function addBattleOfPichinchaDay(): void
{
if ($this->year >= 1822) {
$this->addHoliday(new Holiday('battleOfPichinchaDay',
['en' => 'Battle of Pichincha Day', 'es' => 'Batalla del Pichincha'],
new \DateTime("{$this->year}-05-24", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
}
/**
* First Cry of Independence — August 10 (since 1809).
*
* Ecuador's national day; first uprising against Spanish colonial rule.
*
* @see https://en.wikipedia.org/wiki/Primer_Grito_de_Independencia
*/
protected function addFirstCryOfIndependenceDay(): void
{
if ($this->year >= self::INDEPENDENCE_YEAR) {
$this->addHoliday(new Holiday('firstCryOfIndependenceDay',
['en' => 'First Cry of Independence', 'es' => 'Primer Grito de Independencia'],
new \DateTime("{$this->year}-08-10", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
}
/**
* Independence of Guayaquil — October 9 (since 1820).
*
* @see https://en.wikipedia.org/wiki/Guayaquil
*/
protected function addGuayaquilIndependenceDay(): void
{
if ($this->year >= 1820) {
$this->addHoliday(new Holiday('guayaquilIndependenceDay',
['en' => 'Independence of Guayaquil', 'es' => 'Independencia de Guayaquil'],
new \DateTime("{$this->year}-10-09", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
}
/**
* All Souls' Day — November 2.
*
* Ecuador observes All Souls' Day (Nov 2), not All Saints' Day (Nov 1).
*/
protected function addAllSoulsDay(): void
{
$this->addHoliday(new Holiday('allSoulsDay',
['en' => "All Souls' Day", 'es' => 'Día de los Difuntos'],
new \DateTime("{$this->year}-11-02", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
/**
* Foundation of Quito Day — December 6 (since 1534).
*
* @see https://en.wikipedia.org/wiki/Quito
*/
protected function addFoundationOfQuitoDay(): void
{
if ($this->year >= 1534) {
$this->addHoliday(new Holiday('foundationOfQuitoDay',
['en' => 'Foundation of Quito', 'es' => 'Fundación de Quito'],
new \DateTime("{$this->year}-12-06", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
}
}
New translation files
src/Yasumi/data/translations/carnivalMonday.php
<?php declare(strict_types = 1);
return ['en' => 'Carnival Monday', 'es' => 'Lunes de Carnaval', 'pt' => 'Segunda-feira de Carnaval'];
src/Yasumi/data/translations/carnivalTuesday.php
<?php declare(strict_types = 1);
return ['en' => 'Carnival Tuesday', 'es' => 'Martes de Carnaval', 'pt' => 'Terça-feira de Carnaval'];
src/Yasumi/data/translations/battleOfPichinchaDay.php
<?php declare(strict_types = 1);
return ['en' => 'Battle of Pichincha Day', 'es' => 'Batalla del Pichincha'];
src/Yasumi/data/translations/firstCryOfIndependenceDay.php
<?php declare(strict_types = 1);
return ['en' => 'First Cry of Independence', 'es' => 'Primer Grito de Independencia'];
src/Yasumi/data/translations/guayaquilIndependenceDay.php
<?php declare(strict_types = 1);
return ['en' => 'Independence of Guayaquil', 'es' => 'Independencia de Guayaquil'];
src/Yasumi/data/translations/foundationOfQuitoDay.php
<?php declare(strict_types = 1);
return ['en' => 'Foundation of Quito', 'es' => 'Fundación de Quito'];
carnivalMonday and carnivalTuesday are also used by Venezuela — a single pair of translation files covers both providers.
tests/Ecuador/EcuadorBaseTestCase.php
<?php
declare(strict_types = 1);
namespace Yasumi\Tests\Ecuador;
use PHPUnit\Framework\TestCase;
use Yasumi\Tests\YasumiBase;
abstract class EcuadorBaseTestCase extends TestCase
{
use YasumiBase;
public const REGION = 'Ecuador';
public const TIMEZONE = 'America/Guayaquil';
public const LOCALE = 'es_EC';
public const TOTAL_HOLIDAYS = 12;
}
tests/Ecuador/EcuadorTest.php
<?php
declare(strict_types = 1);
namespace Yasumi\Tests\Ecuador;
use PHPUnit\Framework\Attributes\DataProvider;
use Yasumi\Tests\HolidayTestInterface;
use Yasumi\Yasumi;
class EcuadorTest extends EcuadorBaseTestCase implements HolidayTestInterface
{
public function testTotalHolidays(): void
{
$this->assertCount(self::TOTAL_HOLIDAYS, Yasumi::create(self::REGION, 2025));
}
public function testCountryCode(): void
{
$this->assertEquals('EC', Yasumi::create(self::REGION, 2025)->getCountry());
}
#[DataProvider('carnivalMondayDataProvider')]
public function testCarnivalMonday(int $year, \DateTime $expected): void
{
$this->assertHoliday(self::REGION, 'carnivalMonday', $year, $expected);
}
public static function carnivalMondayDataProvider(): array
{
return [
[2023, new \DateTime('2023-02-20', new \DateTimeZone(self::TIMEZONE))],
[2024, new \DateTime('2024-02-12', new \DateTimeZone(self::TIMEZONE))],
[2025, new \DateTime('2025-03-03', new \DateTimeZone(self::TIMEZONE))],
];
}
#[DataProvider('carnivalTuesdayDataProvider')]
public function testCarnivalTuesday(int $year, \DateTime $expected): void
{
$this->assertHoliday(self::REGION, 'carnivalTuesday', $year, $expected);
}
public static function carnivalTuesdayDataProvider(): array
{
return [
[2023, new \DateTime('2023-02-21', new \DateTimeZone(self::TIMEZONE))],
[2024, new \DateTime('2024-02-13', new \DateTimeZone(self::TIMEZONE))],
[2025, new \DateTime('2025-03-04', new \DateTimeZone(self::TIMEZONE))],
];
}
#[DataProvider('battleOfPichinchaDataProvider')]
public function testBattleOfPichinchaDay(int $year, \DateTime $expected): void
{
$this->assertHoliday(self::REGION, 'battleOfPichinchaDay', $year, $expected);
}
public static function battleOfPichinchaDataProvider(): array
{
return [
[2023, new \DateTime('2023-05-24', new \DateTimeZone(self::TIMEZONE))],
[2024, new \DateTime('2024-05-24', new \DateTimeZone(self::TIMEZONE))],
[2025, new \DateTime('2025-05-24', new \DateTimeZone(self::TIMEZONE))],
];
}
#[DataProvider('firstCryDataProvider')]
public function testFirstCryOfIndependenceDay(int $year, \DateTime $expected): void
{
$this->assertHoliday(self::REGION, 'firstCryOfIndependenceDay', $year, $expected);
}
public static function firstCryDataProvider(): array
{
return [
[2023, new \DateTime('2023-08-10', new \DateTimeZone(self::TIMEZONE))],
[2024, new \DateTime('2024-08-10', new \DateTimeZone(self::TIMEZONE))],
[2025, new \DateTime('2025-08-10', new \DateTimeZone(self::TIMEZONE))],
];
}
public function testFirstCryOfIndependenceDayBeforeEstablishment(): void
{
$this->assertNotHoliday(self::REGION, 'firstCryOfIndependenceDay', 1808);
}
#[DataProvider('guayaquilIndependenceDataProvider')]
public function testGuayaquilIndependenceDay(int $year, \DateTime $expected): void
{
$this->assertHoliday(self::REGION, 'guayaquilIndependenceDay', $year, $expected);
}
public static function guayaquilIndependenceDataProvider(): array
{
return [
[2023, new \DateTime('2023-10-09', new \DateTimeZone(self::TIMEZONE))],
[2024, new \DateTime('2024-10-09', new \DateTimeZone(self::TIMEZONE))],
[2025, new \DateTime('2025-10-09', new \DateTimeZone(self::TIMEZONE))],
];
}
}
References
Summary
Ecuador is missing from Yasumi's list of supported countries. This issue proposes adding a full
Ecuadorholiday provider covering all 12 official public holidays established by the Ecuadorian Labor Code (Código del Trabajo, Art. 65), along with translations and unit tests.Country details
Proposed implementation
src/Yasumi/Provider/Ecuador.phpProvider for all holidays in Ecuador.
Ecuador observes 12 public holidays established by the Labor Code (Art. 65).
@see https://en.wikipedia.org/wiki/Public_holidays_in_Ecuador
*/
class Ecuador extends AbstractProvider
{
use CommonHolidays;
use ChristianHolidays;
public const INDEPENDENCE_YEAR = 1809;
public const ID = 'EC';
/**
@throws \InvalidArgumentException
@throws UnknownLocaleException
@throws \Exception
*/
public function initialize(): void
{
$this->timezone = 'America/Guayaquil';
$this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->internationalWorkersDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->maundyThursday($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale));
$this->addCarnivalMonday();
$this->addCarnivalTuesday();
$this->addBattleOfPichinchaDay();
$this->addFirstCryOfIndependenceDay();
$this->addGuayaquilIndependenceDay();
$this->addAllSoulsDay();
$this->addFoundationOfQuitoDay();
}
public function getSources(): array
{
return [
'https://en.wikipedia.org/wiki/Public_holidays_in_Ecuador',
'https://www.trabajo.gob.ec/',
];
}
/**
*/
protected function addCarnivalMonday(): void
{
$date = (clone $this->calculateEaster($this->year, $this->timezone))->sub(new \DateInterval('P48D'));
$this->addHoliday(new Holiday('carnivalMonday',
['en' => 'Carnival Monday', 'es' => 'Lunes de Carnaval'],
$date, $this->locale));
}
/** Carnival Tuesday — Easter − 47 days. */
protected function addCarnivalTuesday(): void
{
$date = (clone $this->calculateEaster($this->year, $this->timezone))->sub(new \DateInterval('P47D'));
$this->addHoliday(new Holiday('carnivalTuesday',
['en' => 'Carnival Tuesday', 'es' => 'Martes de Carnaval'],
$date, $this->locale));
}
/**
*/
protected function addBattleOfPichinchaDay(): void
{
if ($this->year >= 1822) {
$this->addHoliday(new Holiday('battleOfPichinchaDay',
['en' => 'Battle of Pichincha Day', 'es' => 'Batalla del Pichincha'],
new \DateTime("{$this->year}-05-24", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
}
/**
*/
protected function addFirstCryOfIndependenceDay(): void
{
if ($this->year >= self::INDEPENDENCE_YEAR) {
$this->addHoliday(new Holiday('firstCryOfIndependenceDay',
['en' => 'First Cry of Independence', 'es' => 'Primer Grito de Independencia'],
new \DateTime("{$this->year}-08-10", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
}
/**
*/
protected function addGuayaquilIndependenceDay(): void
{
if ($this->year >= 1820) {
$this->addHoliday(new Holiday('guayaquilIndependenceDay',
['en' => 'Independence of Guayaquil', 'es' => 'Independencia de Guayaquil'],
new \DateTime("{$this->year}-10-09", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
}
/**
*/
protected function addAllSoulsDay(): void
{
$this->addHoliday(new Holiday('allSoulsDay',
['en' => "All Souls' Day", 'es' => 'Día de los Difuntos'],
new \DateTime("{$this->year}-11-02", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
/**
@see https://en.wikipedia.org/wiki/Quito
*/
protected function addFoundationOfQuitoDay(): void
{
if ($this->year >= 1534) {
$this->addHoliday(new Holiday('foundationOfQuitoDay',
['en' => 'Foundation of Quito', 'es' => 'Fundación de Quito'],
new \DateTime("{$this->year}-12-06", DateTimeZoneFactory::getDateTimeZone($this->timezone)),
$this->locale));
}
}
}
New translation files
src/Yasumi/data/translations/carnivalMonday.phpsrc/Yasumi/data/translations/carnivalTuesday.phpsrc/Yasumi/data/translations/battleOfPichinchaDay.phpsrc/Yasumi/data/translations/firstCryOfIndependenceDay.phpsrc/Yasumi/data/translations/guayaquilIndependenceDay.phpsrc/Yasumi/data/translations/foundationOfQuitoDay.phptests/Ecuador/EcuadorBaseTestCase.phptests/Ecuador/EcuadorTest.phpReferences
- Public holidays in Ecuador — Wikipedia
- Código del Trabajo — Ministerio del Trabajo
- Battle of Pichincha — Wikipedia
- Primer Grito de Independencia — Wikipedia
# Add Holiday Provider for Ecuador 🇪🇨Summary
Ecuador is missing from Yasumi's list of supported countries. This issue proposes adding a full
Ecuadorholiday provider covering all 12 official public holidays established by the Ecuadorian Labor Code (Código del Trabajo, Art. 65), along with translations and unit tests.Country details
ECAmerica/Guayaquiles_ECComplete holiday list
newYearsDaycarnivalMondaycarnivalTuesdaymaundyThursdaygoodFridaybattleOfPichinchaDayinternationalWorkersDayfirstCryOfIndependenceDayguayaquilIndependenceDayallSoulsDayfoundationOfQuitoDaychristmasDayProposed implementation
src/Yasumi/Provider/Ecuador.phpNew translation files
src/Yasumi/data/translations/carnivalMonday.phpsrc/Yasumi/data/translations/carnivalTuesday.phpsrc/Yasumi/data/translations/battleOfPichinchaDay.phpsrc/Yasumi/data/translations/firstCryOfIndependenceDay.phpsrc/Yasumi/data/translations/guayaquilIndependenceDay.phpsrc/Yasumi/data/translations/foundationOfQuitoDay.phptests/Ecuador/EcuadorBaseTestCase.phptests/Ecuador/EcuadorTest.phpReferences