Comments (12)
Please provide your config (the code with BusinessDay::enable(...
) and your Carbon version so I can try to reproduce.
from business-day.
mi carbon.php is a customized file,with not standart region, laravel 8.25, "nesbot/carbon", "version": "2.44.0",
<?php
return [
'holidays' => [
'region' => 'raps-national',
'with' => [
'new-year' => '01-01',
'easter-48' => '= easter -48',
'easter-47' => '= easter -47',
'day-of-remembrance-for-truth-and-justice' => '03-24',
'bridge-day' => '= 03-24 if Tuesday then previous Monday and if Thursday then next Friday',
'saint-thursday' => '= easter -3',
'saint-friday' => '= easter -2',
'day-of-the-veterans-and-the-fallen-of-malvinas-war' => '04-02',
'substitutes-day-of-the-veterans' => '= 04-02 if Tuesday then previous Monday and if Thursday then next Friday',
'labor-day' => '05-01',
'substitutes-labor-day' => '= 05-01 if Tuesday then previous Monday and if Thursday then next Friday',
'day-of-the-first-national-government' => '05-25',
'substitutes-may-revolution' => '= 05-25 if Tuesday then previous Monday and if Thursday then next Friday',
'guemes-day' => '= 06-17 if Tuesday then previous Monday and if Wednesday,Thursday,Friday,Saturday,Sunday then next Monday',
'national-flag-day' => '06-20',
'substitutes-flag-day' => '= 06-20 if Tuesday then previous Monday and if Thursday then next Friday',
'independence-day' => '07-09',
'anniversary-of-the-death-of-general-josyo-de-san-martyun' => '= 08-17 if Tuesday then previous Monday and if Thursday then next Monday',
'day-of-respect-for-cultural-diversity' => '= 10-12 if Tuesday,Wednesday then previous Monday and if Thursday,Friday,Saturday,Sunday then next Monday',
'substitutes-day-of-respect-for-cultural-diversity'=> '10-08',
'day-of-national-sovereignty' => '11-20',
'substitutes-soberany-day' => '= 11-20 if Tuesday,Wednesday then previous Monday and if Thursday,Friday,Saturday,Sunday then next Monday',
'virgin-day' => '12-08',
'substitutes-virgin-day' => '= 12-08 if Tuesday then previous Monday and if Thursday then next Friday',
'noche-buena' => '12-24',
'christmas' => '12-25',
'substitutes-christmas' => '= 12-25 if Tuesday then previous Monday and if Thursday then next Friday',
'noche-vieja' => '12-31',
],
// extra work days (even if in the weekend)
'without' => [],
],
];
from business-day.
I tried your settings but couldn't reproduce the error using the live editor
Would you be able to give a minimum code chunk to reproduce on https://try-carbon.herokuapp.com/ please?
from business-day.
Could you also give me your PHP version running this (replacing now()->isHoliday()
with echo PHP_VERSION;
and running the code the same way you got the error).
from business-day.
I made some tests.
echo PHP_VERSION; 7.4.3 No errors
If I delete the config file and use enable with baselist = 'us-national', get the same warning;
Then I upload the project to a server and in artisan tinker get the same warning;
Because I get the library this weekend, I dont have especial code involve, just a simple check isHoliday(), is a big project with Laravel Nova.
from business-day.
Creating a Laravel project from scratch and running now()->isHoliday()
causes no issues, so I can't figure out without a code chunk able to reproduce the bug. Please try to reduce it to the bare minimum to get the error occur, ideally outside Laravel.
from business-day.
OK, close the issue if you like. When I reproduce the bug, I'll contact you. Thanks for you attention (and your LIB)!!!
from business-day.
Actually errors at those lines are supposed to be muted (to fallback to static closure). So you should also check your error reporting setting. May you have something disabling @
?
Also, can you check if this code reproduces your bug:
Carbon::macro('foo', static function () { return 'foo'; });
echo Carbon::foo();
If so, then your setup clearly has something incompatible with the whole macro system of Carbon.
Eventually, you may try to dump $macro
at this point to see on which macro it fails.
from business-day.
this code
Carbon::macro('foo', static function () { return 'foo'; });
echo Carbon::foo();
work 'OK', without warning
from business-day.
What about the other question? Can you give the content of $macro
on src/Carbon/Traits/Date.php on line 2413 when it fails?
I tried same with a fresh install of laravel 8.25.0. then requiring cmixin/business-day
, copy-paste your config/carbon.php file then now()->isHoliday()
worked just fine.
I can't help much more. I can just advise to try to start from a clean app an try to move pieces by chunk to see when it comes to throw the error so you might be able to produce a minimum code to reproduce, then I can add it to unit tests and fix it.
Thanks.
from business-day.
In my project, I have a shutdown function that will log an error if the return value of error_get_last()
is an error. This warning was muted, however there is still an error. Is there a way to use this without generating errors (even if they're muted)?
from business-day.
Actually there is not much that can be done from business-day side.
This error is thrown and caught from Carbon side, and it's actually done this way because PHP provides no way to know if a given closure
is static or not.
Only way would be a very verbose and heavy set_error_handler
around each call that can throw a PHP error.
If you can use set_error_handler
in your own application globally to throw ErrorException
instead of native PHP error, you should no longer have this problem and possibly a better control over real PHP errors occurring.
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
- 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.