Comments (1)
Yes you should because, each day need an identifier. The isHoliday
would be much slower if we would have to check ranges of dates.
$baseList = 'custom';
$additionalHolidays = array(
);
$start = Carbon::parse('2019-12-24');
for ($i = 1; $i <= 10; $i++) {
$additionalHolidays['christmas-holidays-day-'.$i] = $start->format('m-d');
$start->addDay();
}
BusinessDay::enable(Carbon::class, $baseList, $additionalHolidays);
var_dump(Carbon::parse('2021-12-23')->isHoliday()); // false
var_dump(Carbon::parse('2021-12-24')->isHoliday()); // true
var_dump(Carbon::parse('2021-12-25')->isHoliday()); // true
var_dump(Carbon::parse('2022-01-01')->isHoliday()); // true
var_dump(Carbon::parse('2022-01-02')->isHoliday()); // true
var_dump(Carbon::parse('2022-01-03')->isHoliday()); // false
from business-day.
Related Issues (20)
- Request for update: south africa (ZA) holidays
- Undefined method parse HOT 4
- How can I make a day of the week a non-business day? HOT 1
- Business days are not accurate for some countries HOT 1
- Incorrect public holiday for South Africa HOT 1
- How to add multiple independence-day configuration items in carbon.php? HOT 13
- I have problem saturday in april HOT 1
- Warning: Cannot bind an instance to a static closure in vendor/nesbot/carbon/src/Carbon/Traits/Date.php on line 2413 HOT 12
- Holiday detected as wednesday when really is Thursday HOT 2
- Problem with polish holidays HOT 1
- Unknown holiday name in pl HOT 2
- if Sunday then next Tuesday does not work as expected HOT 1
- Bug in italian calculation HOT 1
- Programatically get a list of available regions HOT 1
- Cannot get expression to work properly HOT 4
- Relative logic not working on January 1st HOT 4
- Add Juneteenth to US national holidays HOT 3
- Getting a list of holidays in parsable carbon format HOT 1
- The demo is broken HOT 1
- Possible to add alternative holiday name of the same id? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from business-day.