Download the PHP package geoffreyrose/useful-dates-us-holidays without Composer
On this page you can find all versions of the php package geoffreyrose/useful-dates-us-holidays. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download geoffreyrose/useful-dates-us-holidays
More information about geoffreyrose/useful-dates-us-holidays
Files in geoffreyrose/useful-dates-us-holidays
Package useful-dates-us-holidays
Short Description Useful Dates - US Holidays Extension
License MIT
Informations about the package useful-dates-us-holidays
US Holidays Extension For Useful Dates
Adds 42 US holidays to use with Useful Dates.
This is the next evolution of geoffreyrose/us-holidays but for my date package Useful Dates.
Requirements
- PHP 8.4+
- Useful Dates
Supported Holidays
- April Fool's Day
- Armed Forces Day
- Ash Wednesday
- Black Friday
- Christmas Day
- Christmas Eve
- Cinco de Mayo
- Columbus Day
- Cyber Monday
- Daylight Saving (End)
- Daylight Saving (Start)
- Earth Day
- Easter
- Father's Day
- Flag Day
- Good Friday
- Groundhog Day
- Halloween
- Hanukkah
- Independence Day
- Indigenous Peoples' Day
- Juneteenth
- Kwanzaa
- Labor Day
- Martin Luther King Jr. Day
- Memorial Day
- Mother's Day
- New Year's Day
- New Year's Eve
- Orthodox Easter
- Palm Sunday
- Passover
- Patriot Day
- Pearl Harbor Remembrance Day
- Presidents' Day
- Rosh Hashanah
- St. Patrick's Day
- Tax Day
- Thanksgiving
- Valentine's Day
- Veterans Day
- Yom Kippur
Optionally, you can also include the "observed" holidays.
Observed Holidays are when the Federal Holiday falls on a Saturday it is observed on the previous day (Friday) or when it falls on a Sunday it is observed on the next day (Monday).
- Christmas Day (Observed)
- Independence Day (Observed)
- Juneteenth (Observed)
- New Year's Day (Observed)
- Veterans Day (Observed)
Usage
Installation
Basic Usage
To include observed holidays, use the include_observed option.
Additional Methods
This extension adds two helper methods to check if a date is a bank or federal holiday:
isBankHoliday(): bool
Check if the current date is a Bank Holiday and the day it is observed on.
Bank Holiday Rules:
- If the holiday falls on Sunday, it is observed the next day (Monday)
- Bank holidays that fall on Saturday are NOT observed on the previous Friday
- Only applies to holidays that can fall Monday - Friday
- Holidays that always fall on weekends are not considered bank holidays
Returns:
trueif the date is a bank holidayfalseif the date is not a bank holiday
Example:
isFederalHoliday(): bool
Check if the current date is a Federal Holiday and the day it is observed on.
Federal Holiday Rules:
- If the holiday falls on Saturday, it is observed the previous day (Friday)
- If the holiday falls on Sunday, it is observed the next day (Monday)
- Only applies Monday - Friday
- Holidays that always fall on weekends are not considered federal holidays
Returns:
trueif the date is a federal holidayfalseif the date is not a federal holiday
Example:
Getting Holiday Information
You can retrieve holiday information for specific dates:
Or get all holidays for a year:
Holiday Properties
Each holiday object includes the following properties:
name- The official name of the holidayis_bank_holiday- Boolean indicating if it's a bank holidayis_federal_holiday- Boolean indicating if it's a federal holidaybank_holiday_start_year- The year the holiday became a bank holiday (if applicable)bank_holiday_end_year- The year the holiday ceased being a bank holiday (if applicable)federal_holiday_start_year- The year the holiday became a federal holiday (if applicable)federal_holiday_end_year- The year the holiday ceased being a federal holiday (if applicable)
Example: