azuyalabs / yasumi

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

Veterans Day in USA subtitution #91

Closed daffoxdev closed 5 years ago

daffoxdev commented 6 years ago

Hi. Looks like Veterans Day(11 november) in USA in 2018 will be substituted by 12 november (monday), but the library not showing that. I'm right?

As I see in code, there no calculations for this holiday in case of substitution.

in file Provider/USA.php:

<?php
//...
          // Only process New Year's Day, Independence Day, or Christmas Day
            if (in_array(
                $datesIterator->current()->shortName,
                ['newYearsDay', 'independenceDay', 'christmasDay'],
                true
            )) {
//...

Thank you.

stelgenhof commented 6 years ago

Perhaps the substitution rules for the USA are not perfectly correct in the USA Provider. This part of the code only determines substitutions for those 3 holidays.

However, looking at this source: https://en.wikipedia.org/wiki/Federal_holidays_in_the_United_States it looks to be the other way around. New Years Day, Independence Day, Veterans Day and Christmas Day are all fixed.

I'm maybe not all that familiar with the USA official rules. Do you maybe have a good source for that?

Cheers! Sacha

jagers commented 5 years ago

Per wikipedia,

holiday falling on a Saturday is observed on the preceding Friday, while a holiday falling on a Sunday is observed on the succeeding Monday

The official executive order can be found here: https://www.archives.gov/federal-register/codification/executive-order/11582.html

Section 3(a) essentially means that all holidays are eligible to have substitute holidays, not just New Years Day, Independence Day, and Christmas Day. In reality, this library is only missing Veteran's day since that is the only other day that is not guaranteed to fall on a weekday.

stelgenhof commented 5 years ago

Resolved in release v2.1.0