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

Add Malaysia holiday #17

Merged
merged 19 commits into from
Oct 1, 2024
Merged

Conversation

pisyek
Copy link
Contributor

@pisyek pisyek commented Jan 17, 2024

No description provided.

@Nielsvanpach
Copy link
Member

Could you rebase this branch, in order to run the tests here?

@pisyek pisyek force-pushed the add-malaysia-holiday branch 2 times, most recently from c3bb10d to 77a7443 Compare January 23, 2024 01:46
src/Countries/Malaysia.php Outdated Show resolved Hide resolved
'swk' => $this->regionSarawak($year),
'sgr' => $this->regionSelangor($year),
'trg' => $this->regionTerengganu($year),
default => array_merge(
Copy link
Member

Choose a reason for hiding this comment

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

By default I wouldn't return any region specific holidays. What you think?

Copy link
Contributor Author

@pisyek pisyek Jan 25, 2024

Choose a reason for hiding this comment

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

i think it is better to add check if region is set; then throw a new exception invalid region if no match. better flow right? @Nielsvanpach

but the reason i put the default to return all is to allow users to get all holidays in Malaysia.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not aware of the situation in Malaysia, but I think returning all national public holidays by default if no region is given, might be the way to go. This is more in line with implementation for other countries. https://publicholidays.com.my/2024-dates/

tests/Countries/MalaysiaTest.php Show resolved Hide resolved
@pisyek pisyek force-pushed the add-malaysia-holiday branch 2 times, most recently from 37acfb2 to f0214a1 Compare January 26, 2024 00:07
tests/Countries/MalaysiaTest.php Outdated Show resolved Hide resolved
tests/Countries/MalaysiaTest.php Outdated Show resolved Hide resolved
src/Countries/Malaysia.php Outdated Show resolved Hide resolved
'swk' => $this->regionSarawak($year),
'sgr' => $this->regionSelangor($year),
'trg' => $this->regionTerengganu($year),
default => array_merge(
Copy link
Member

Choose a reason for hiding this comment

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

I'm not aware of the situation in Malaysia, but I think returning all national public holidays by default if no region is given, might be the way to go. This is more in line with implementation for other countries. https://publicholidays.com.my/2024-dates/

src/Countries/Malaysia.php Outdated Show resolved Hide resolved
src/Countries/Malaysia.php Outdated Show resolved Hide resolved
src/Countries/Malaysia.php Outdated Show resolved Hide resolved
src/Countries/Malaysia.php Show resolved Hide resolved
src/Countries/Malaysia.php Outdated Show resolved Hide resolved
@Nielsvanpach
Copy link
Member

Nielsvanpach commented Jan 26, 2024

I'm probably merging this PR soon, so might be best to use his implementation of the ChineseCalendar.

@pisyek
Copy link
Contributor Author

pisyek commented Jan 27, 2024

I'm probably merging this PR soon, so might be best to use his implementation of the ChineseCalendar: #115

i'll update my PR once #115 merge.

@pisyek pisyek force-pushed the add-malaysia-holiday branch 3 times, most recently from 029914d to 0455f04 Compare January 29, 2024 15:48
@pisyek pisyek requested a review from Nielsvanpach January 31, 2024 13:12
@pisyek pisyek force-pushed the add-malaysia-holiday branch from 0455f04 to ab27a90 Compare February 2, 2024 08:46
Copy link
Member

@Nielsvanpach Nielsvanpach left a comment

Choose a reason for hiding this comment

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

Perhaps you could take a look at other classes, and refactor the code to make it look more like other Countries?

Examples: Belgium, Albania, Jamaica, ..

src/Countries/Malaysia.php Outdated Show resolved Hide resolved
src/Countries/Malaysia.php Outdated Show resolved Hide resolved
src/Countries/Malaysia.php Outdated Show resolved Hide resolved
src/Countries/Malaysia.php Outdated Show resolved Hide resolved
src/Countries/Malaysia.php Outdated Show resolved Hide resolved
src/Countries/Malaysia.php Show resolved Hide resolved
src/Countries/Malaysia.php Outdated Show resolved Hide resolved
src/Countries/Malaysia.php Outdated Show resolved Hide resolved
src/Countries/Malaysia.php Outdated Show resolved Hide resolved
tests/Countries/MalaysiaTest.php Outdated Show resolved Hide resolved
@pisyek pisyek force-pushed the add-malaysia-holiday branch from 7f02190 to 5a28447 Compare February 9, 2024 08:26
@pisyek pisyek force-pushed the add-malaysia-holiday branch from 5a28447 to c929e4b Compare March 2, 2024 03:14
@pisyek pisyek requested a review from Nielsvanpach March 2, 2024 03:15
@pisyek pisyek closed this Mar 26, 2024
@Nielsvanpach
Copy link
Member

Thanks for all the work!

@Nielsvanpach Nielsvanpach reopened this Jun 15, 2024
@Nielsvanpach Nielsvanpach merged commit 109649a into spatie:main Oct 1, 2024
13 of 14 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.

2 participants