azuyalabs / yasumi

The easy PHP Library for calculating holidays
https://www.yasumi.dev
Other
1.04k stars 152 forks source link

set weekend_days #89

Closed hirorongl closed 5 years ago

hirorongl commented 6 years ago

set weekend_days = [0];

stelgenhof commented 6 years ago

Could you explain what issue you encountered? Unfortunately your description doesn't explain the issue, so it is difficult to assess it.

hirorongl commented 6 years ago

I want to judge that only Sunday is a holiday and I want to judge that Saturday is weekday

hirorongl commented 6 years ago

I would like protected weekend_days to be set later when creating a sales calendar that will open only on Tuesdays and holidays as holidays

stelgenhof commented 6 years ago

Ah, understand it better now. Indeed, that is currently not implemented well. I am thinking of adding a feature where Yasumi already includes the settings for weekends for each country.

hirorongl commented 6 years ago

That's good. In that case please implement so that it can be changed later by set. I am looking forward to the implementation

stelgenhof commented 6 years ago

I've made changes to the weekend definitions that will now include also countries that have weekends that differ from the common global standard (Saturday + Sunday).

After re-reading your request, I'm not sure whether overriding the weekend variable is the correct path. The current weekend definition is what each country officially considers to be the weekend.

I believe your request is a bit different in the sense that what you consider 'holidays' (or in your case: shop open days). An alternative is to extend and create your own Holiday Provider that incorporates your business rules.

Let me know if your use case is different :)

Cheers! Sacha

hirorongl commented 6 years ago

It was definitely a request away from the definition of an official holiday.

The request is close to the regular holiday (Teikyuubi) mentioned in Japan.

It would be helpful if you let me know a sample of how to create a Holiday Provider that corresponds to a regular holiday (Teikyuubi) in Cookbook or Document

stelgenhof commented 6 years ago

Sure! I think I will create a recipe for this in the Cookbook. There was somebody else last year with similar question, so a recipe would make sense :)

stelgenhof commented 5 years ago

@hirorongl You can find an example on how to extend an existing HolidayProvider here: http://azuyalabs.github.io/yasumi/cookbook/custom_provider/