Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Albanian National Holidays #157

Merged
merged 8 commits into from
Jan 31, 2024

Conversation

MirilTerolli
Copy link
Contributor

@MirilTerolli MirilTerolli commented Jan 22, 2024

Official Albanian holidays, as documented by the Albanian government portal https://e-albania.al/Pages/OfficialHolidays.aspx
Includes tentative dates for Eid al-Fitr and Eid al-Adha holidays until 2034, because the dates are not static.

- Add Albanian national holidays including tentative dates for islamic holidays that are TBD.
- Test coverage.
- Add test coverage for holidays with standard dates.
- Add empty line in the end of the testing file.
- Fix empty line warning in the end of the file.
- Fix php stan error.
'Dita e Pavarësisë' => '11-28',
'Dita e Çlirimit' => '11-29',
'Dita Kombëtare e Rinisë' => '12-08',
'Krishtlindjet' => '12-25',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MirilTerolli Krishtlindjet should be Krishtlindja

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fitimvata it's done.

@Nielsvanpach
Copy link
Member

In case you want to add multi language support: https://github.com/spatie/holidays/tree/main/lang

- Translation for German, English, Spanish, French, Greek, Italian, Portughese, Russian, Turkish.
@MirilTerolli
Copy link
Contributor Author

In case you want to add multi language support: https://github.com/spatie/holidays/tree/main/lang

Good idea @Nielsvanpach , it's done! 👍

2032 => '01-14',
2033 => '01-02',
2034 => '12-12',
default => '01-01' // Temporary placeholder; requires ongoing maintenance.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would throw an exception by default and make sure we don't return false data

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nielsvanpach , that would be a good idea, but this would prevent other standard holidays from not being displayed in case if we run something like this Holidays::for(country: "al", year: 2035)->get(); 🤷‍♂️

2032 => '03-22',
2033 => '03-12',
2034 => '03-01',
default => '01-01' // Temporary placeholder; requires ongoing maintenance.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would throw an exception by default and make sure we don't return false data

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nielsvanpach as mentioned above, throwing an exception will prevent the standard holidays from being displayed.
I wonder if this is what we want.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can't provide valid data, I prefer to throw an exception.

Copy link

@fitimvata fitimvata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MirilTerolli I personally would do something like requested changes. Return null from getEidAlFitrHoliday and getEidAlAdhaHoliday and filter array in variableHolidays

/**
*
*/
private function getEidAlFitrHoliday(int $year): string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private function getEidAlFitrHoliday(int $year): string
private function getEidAlFitrHoliday(int $year): ?string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fitimvata that could work as well, changes pushed.

2032 => '01-14',
2033 => '01-02',
2034 => '12-12',
default => '01-01' // Temporary placeholder; requires ongoing maintenance.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default => '01-01' // Temporary placeholder; requires ongoing maintenance.
default => null // Temporary placeholder; requires ongoing maintenance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fitimvata pushed.

};
}

private function getEidAlAdhaHoliday(int $year): string

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private function getEidAlAdhaHoliday(int $year): string
private function getEidAlAdhaHoliday(int $year): ?string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fitimvata changes pushed.

2032 => '03-22',
2033 => '03-12',
2034 => '03-01',
default => '01-01' // Temporary placeholder; requires ongoing maintenance.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default => '01-01' // Temporary placeholder; requires ongoing maintenance.
default => null // Temporary placeholder; requires ongoing maintenance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fitimvata pushed.

/** @return array<string, CarbonImmutable|string> */
protected function variableHolidays(int $year): array
{
return [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return [
return array_filter([

'E diela e Pashkëve Ortodokse' => $this->orthodoxEaster($year),
'Dita e Bajramit të Madh' => $this->getEidAlFitrHoliday($year),
'Dita e Kurban Bajramit' => $this->getEidAlAdhaHoliday($year),
];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
];
]);

@Nielsvanpach Nielsvanpach merged commit feda8ec into spatie:main Jan 31, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants