Giter Site home page Giter Site logo

business-day's Introduction

👋 Hello there!

Open-Source

Crossing many languages on daily basis, PHP, my first love still keeps an important place in my dev life.

That's why I contribute to librariries, frameworks and tools, mainly in this language and why I happilly continued the @briannesbitt's work on Carbon now maintaining this date library for 3 years:

Carbon

If you use Symfony, Laravel, PHPMD, or Pug, then maybe you run some of my code among the thousands pieces of your vendor directory.

❤️ If you feel lucky, you can sustain my OS work sending tips via GitHub Sponsor

Or consider taking a Tidelift subscription for your company to sustain globally all the Open-Source dependencies you use

🙏 Thank you so much to all people sustaining the Open-Source world!

Privacy

Last topic I particularly care is privacy, that's why I believe Proton deserve to be known, Proton defends freedom on the top of a simple fundamental idea: Privacy should be the default.

business-day's People

Contributors

alexislefebvre avatar brdly avatar ekrist1 avatar endelwar avatar glavic avatar hslatman avatar kylekatarnls avatar maciek-szn avatar makroxyz avatar mal-risma avatar mnabialek avatar mpoma avatar murat-aksoy avatar oxicode avatar pabliyo22 avatar peter279k avatar redcuillin avatar sabas avatar samatcd avatar simbig avatar skyfmmf avatar stylecibot avatar taaz avatar tomahock avatar ziming avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

business-day's Issues

How to add multiple independence-day configuration items in carbon.php?

hi,

I have the following two questions

  1. Some weekends are also weekdays,so I need add multiple independence-day.
  2. I found that the number of days off on some festivals is wrong in our country.
    For example: China’s National Day holiday generally has seven days holiday, but I tested it only has three days holiday. How can I modify or reset it in the carbon.php file.

Range Holidays

How would one set a holiday to be a range of dates from date x to date y?

For example, suppose I wanted all of the dates from Dec 24 thru Jan 2 to be a holiday? Would I need to specify them individually?

Relative logic not working on January 1st

Relative date logic applied to January 1st does not seem to work for specifying a holiday.

Use Case:
This year, 2021 new years day is on a Saturday. Since substitute only applies dates forward, I need to adjust the date backwards. e.g. when January 1st is on a Saturday, I want the previous Friday, December 31st as the holiday/non-business day.

Reproduction:

  • New Year date logic: = 01-01 if Saturday then last Friday
  • Test Date: 20021-12-31
  • Expected result: isHoliday() === true and isBusinessDay() === false
$baseList = 'us-national'; // or region such as 'us-il'

// You can add/remove days (optional):
$additionalHolidays = array(
    'new-year' => '= 01-01 if Saturday then last Friday',
    'test' => '= 12-11 if Saturday then last Friday',
);

BusinessDay::enable('Carbon\Carbon', $baseList, $additionalHolidays);

$date = Carbon::parse('2021-12-31');

var_dump($date->isHoliday()); // false
var_dump($date->isBusinessDay()); // true

The same logic works on a date that is not January 1st:

$date = Carbon::parse('2021-12-10');
var_dump($date->isHoliday()); // true
var_dump($date->isBusinessDay()); // false

Is there a way to configure this use case?

Make cmixin/business-day configurable via Laravel config file

Laravel auto-discovery could be used to automatically run BusinessDay::enable('Illuminate\Support\Carbon'); then a file in config directory could be used to pass options. So Laravel users would not have to run global code on bootstrap.

A great solution would be to create a feature in Carbon first to read composer.json of other packages in the vendor directory, then retrieve the extra.carbon config from it that would indicates to Carbon the packages contains macros/mixins and how to enable and configure them. Then Carbon itself would enable them automatically on the Laravel boot it already has and could even call them in some custom boot method with any other framework.

A fallback solution would be to create class Cmixin\BusinessDay\BusinessDayServiceProvider extending Illuminate\Support\ServiceProvider with the enable() call inside the boot() method and a $this->mergeConfigFrom() inside the register().

Then adding the auto-discovery in composer.json

  "extra": {
    "laravel": {
      "providers": [
        "Cmixin\\BusinessDay\\BusinessDayServiceProvider"
      ]
    }
  }

Good example here: https://github.com/aaroncadrian/carbon-macros/blob/master/src/CarbonServiceProvider.php

Note: Same feature would be added on https://github.com/kylekatarnls/business-time and we should check both can be configured with no conflict.

See kylekatarnls/business-time#10

Problem with polish holidays

Carbon::getYearHolidays(2021) returns Unknown: Wednesday, May 26, 2021 - this isn't holiday and day free of work in Poland, it's actually Mother's Day... Can you fix it?

Holiday Date format inconsistency

Hi Kyle,

The new changes are really awesome, congrats on being able to handle so many different and complex holidays.

The docs are a little inconsistent now. In some places, you are using m-d and in others, you are using d/m. Does it matter which syntax we use?

Some examples:

m-d

'boss-birthday'    => '09-26', // Close the office on September 26th

d/m

Carbon::setHolidays('my-enterprise', array(
    'lincolns-birthday' => array(
        'date'     => '12/02',
        'observed' => true,
        'name'     => array(
            'en' => "Lincoln's Birthday",
            'fr' => 'Anniversaire du Président Lincoln',
        ),
    ),
));

d/m

Carbon::addHolidays('my-list', array(
    'poney'        => '20/01',
    'swimmingpool' => '21/01',
)));
Carbon::addHolidays('my-list', array(
    'boss-birthday'          => '10/02',
    'boss-birthday-next-day' => '11/02',
)));
Carbon::getHolidays('my-list') // contains 20/01, 21/01, 10/02 and 11/02

Bug in italian calculation

Setting "it-national" as region, the calculation in march is wrong because of the "Festa Nazionale" holiday that occurs only in year 2011. This is my code:

BusinessDay::enable('Carbon\Carbon');
$date = Carbon::parse('2021-03-29');
echo $date->subBusinessDays(10)->format('Y-m-d');

In my configuration it shows 2019-03-16 instead of 2019-03-17.

Here is all right: https://try-carbon.herokuapp.com/
What am I doing wrong?

Thanks in advance!

slow diffInBusinessDays()

I need to calculate diffs between many dates and found out that diffInBusinessDays() is very slow.
Could this be somehow improved?
The larger is difference between two dates, the slower it gets.

As an example: for calculating diff in business days between today and every day for next year, it takes approx 30 seconds (not microseconds) - and that is for 365 calls.
Sample code:

<?php
require_once ("../vendor/autoload.php");

use Carbon\Carbon;
use Cmixin\BusinessDay;

function test()
{
    BusinessDay::enable(Carbon::class);
    Carbon::setHolidaysRegion('si-national');
    $time_start = microtime(true);
    $dt1 = Carbon::today();
    for ($i = 1; $i <= 365; $i++) {
        $dt2 = Carbon::today();
        $dt2->addDays($i);
        $diff = $dt1->diffInBusinessDays($dt2);
        print "diff in business days: " . $diff . PHP_EOL;
    }
    $time_end = microtime(true);
    $duration = $time_end - $time_start;
    print "elapsed: " . $duration . " s" . PHP_EOL;
}
test();

Using cmixin/business-day 1.6.0 with PHP 7.2.14,...

Best regards,
Bostjan

Add week-end exceptions

So in our country there are some saturdays that are business day, every year goverment decide wich saturdays are business days.
This is because if between a holiday and weekend is only 1 business day, they swap it with next saturday.

in code i've inserted for example the following:

 public function isBusinessDay()
    {
        $mixin = $this;

        /**
         * Checks the date to see if it is a business day (neither a weekend day nor a holiday).
         *
         * @return bool
         */
        return function ($self = null) use ($mixin) {
            $carbonClass = @get_class() ?: Emulator::getClass(new \Exception());

            /** @var \Carbon\Carbon|\Cmixin\BusinessDay $self */

            $self = $carbonClass::getThisOrToday($self, isset($this) && $this !== $mixin ? $this : null);
            //exception by hand need to automate
            if ($self->format('Y-m-d') == '2020-12-12') {$except = true;} else {$except = false; }

            return ($self->isWeekday() or $except) && !$self->isHoliday();
        };
    }

I would more elegant to have a list in an array

Joe

[Feature Request] List of all holidays for year

Hi Kyle,

If I missed a function for this already, please let me know. I checked each class, but besides Carbon::getHolidays(); (more on that below), I didn't see anything that looked like it would do what I want.

I would like to get a list of all holidays for a specified year (defaulting to this year if nothing was passed). Carbon::getHolidays(); is close, but I would like an array keyed by the holiday's name (translated based on Carbon's current locale) and all closure holidays already computed.

I'm making a page similar to this for my client, and since we're already setting the holidays in Carbon, I would like to just pull that out.

weekend day as business day feature add

There is situation when is nedeed to add a weekend day as business day.

a possible way is to modify BusinessCalendar.php

   public function isBusinessDay()
    {
        $mixin = $this;

        /**
         * Checks the date to see if it is a business day (neither a weekend day nor a holiday).
         *
         * @return bool
         */
        return function ($self = null) use ($mixin) {
            $carbonClass = @get_class() ?: Emulator::getClass(new \Exception());

            /** @var \Carbon\Carbon|\Cmixin\BusinessDay $self */

            $self = $carbonClass::getThisOrToday($self, isset($this) && $this !== $mixin ? $this : null);
            //array of dates put in config global.php 
            $except = in_array($self->format('Y-m-d'), config('global.extraworkdays'));

            return ($self->isWeekday() or $except) && !$self->isHoliday();
        };
    }

the array of extraworkdays could be defined in config/carbon.php also, i think
any other suggestions? purposes?

if Sunday then next Tuesday does not work as expected

I am trying to set holidays that land on a Sunday to have the next business day be the following Tuesday as banks will be closed on that Monday. If I set the holiday as ...

[ 'veterans-day' => '= 11-11 if Sunday then next Tuesday', ];

it will still give me 11-12 if 11-11 falls on a Sunday (ie: Carbon::parse('2018-11-11')->nextBusinessDay(); will give me 2018-11-12 even though it should be 2018-11-13
Screen Shot 2021-04-06 at 2 34 48 PM

MixinBase contains non-macro methods

Currently, \Cmixin\BusinessDay\MixinBase::getCarbonClass and \Cmixin\BusinessDay\MixinBase::enable are both being added as Carbon macros. The latter seems to account for this at least, but does nothing. The former doesn't even return a callback, so just breaks:

\Carbon\Carbon::getCarbonClass()
PHP Warning:  call_user_func_array() expects parameter 1 to be a valid callback, function 'Illuminate/Support/Carbon' not found or invalid function name in vendor/nesbot/carbon/src/Carbon/Traits/Date.php on line 2299

The error arose because I tried to use tutorigo/laravel-ide-macros which scans all registered Carbon macros in order to produce an IDE helper file. When it got to getCarbonClass, it blew up. Since it's deprecated, I'm assuming it only exists for some backward compatibility issue?

It also looks like the entire enable method could simply be moved into the service provider to avoid registering it as a pointless macro if you just make $carbonClass public. It's still not clear to me what the point of setting it is, so I'm probably missing something.

Relax "nesbot/carbon" version requirement

Hi there,

I wasn't able to install this library into my Laravel project (latest stable version, v5.6.23) as "business-day" requires "nesbot/carbon" 1.26+. Laravel requires 1.25.* and unfortunately I can't upgrade it.

Would it be possible to lower the "nesbot/carbon" version requirement for "business-day" to 1.25+?

Thanks

Alternate method of configuring holiday lists that adds more features

It would take significant refactoring, but it might be nice to be able to add more information within the holiday configuration files to make it easier to display the actual purpose of a business being closed on a specific date and to override specific default dates.

The other benefit of the following proposal is that additional attributes could be added in the future without any breaking changes as long as the setHoliday parser just skips unrecognized attributes.

Here is an example of what I'm proposing using the US holiday file:

<?php

return array(
'newyearsday' => [
  'date' => Carbon::parse("January 1 $year")->format('d/m'),
  'holiday' => [
    'en' => 'New Year\'s Day',
  ],
  'observed' => true,
],
'mlkday' => [
  'date' => Carbon::parse("third Monday of January $year")->format('d/m'),
  'holiday' => [
    'en' => 'Martin Luther King Jr. Day',
  ],
  'observed' => true,
],
'easter' => [
  'date' => Carbon::createFromDate($year, 3, 21)->addDays(easter_days($year))->format('d/m'),
  'holiday' => [
    'en' => 'Easter Sunday',
  ],
  'observed' => false,
],
'memorialday' => [
  'date' => Carbon::parse("last Monday of May $year")->format('d/m'),
  'holiday' => [
    'en' => 'Memorial Day',
  ],
  'observed' => true,
],
'independenceday' => [
  'date' => Carbon::parse("July 4 $year")->format('d/m'),
  'holiday' => [
    'en' => 'Independence Day',
  ],
  'observed' => true,
],
'laborday' => [
  'date' => Carbon::parse("first Monday of September $year")->format('d/m'),
  'holiday' => [
    'en' => 'Labor Day',
  ],
  'observed' => true,
],
'thanksgiving' => [
  'date' => Carbon::parse("fourth Thursday of November $year")->format('d/m'),
  'holiday' => [
    'en' => 'Thanksgiving',
  ],
  'observed' => true,
],
'christmasday' => [
  'date' => Carbon::parse("December 25 $year")->format('d/m'),
  'holiday' => [
    'de' => 'Weihnachtstag',
    'en' => 'Christmas Day',
    'es' => 'Día de Navidad',
    'fr' => 'Le jour de Noël',
  ],
  'observed' => true,
]);

isHoliday() can continue to return a boolean value, but another function can be created such as isHolidayDetails() that would return a more expanded object or string of the holiday name.

Perhaps a boolean can be passed such as isHoliday(true) that would cause the function to return the string of the holiday name if true, or false if false.

For example:

Carbon::setHolidaysRegion('us-national');
Carbon::parse('2018-01-15')->isHoliday(true) // 'Martin Luther King Jr. Day' for 2018
Carbon::parse('2018-01-21')->isHoliday(true) // false for 2018
Carbon::parse('2019-01-15')->isHoliday(true) // false for 2019
Carbon::parse('2019-01-21')->isHoliday(true) // 'Martin Luther King Jr. Day' for 2019
Carbon::isHoliday(true) // (str) 'Holiday Name' if today is a holiday, (boolean) false if it is not a holiday

The purpose of using a 'slug' key for the array items is to enable a feature similar to ignoreHoliday('christmas') or observeHoliday('arborday'). It would be a great way to use default national holidays while still allowing easy overrides for businesses that might be open on some of those days.

As an aside, Easter was hell to calculate until I saw the php easter_days() function. :-)

Adding time capabilities

Glad to see this mixin being championed by the Carbon project.

spatie/opening-hours is a package that has some similar goals, but when I asked if they could make it work with Carbon, they said they weren't interested.

I would love to see some of their functionality added to cmixin/business-day

Specifically, while ( isBusinessDay || nextBusinessDay || previousBusinessDay ) are useful, being able to configure opening and closing times could enable you to add functions such as ( isOpen || nextOpen || nextClose || previousOpen || previousClose )

The end result would be to easily build a function that allows people to display data such as how long its been since the business closed, how much time is left until the business closes, and how long until the business opens again if it's closed.

if (Carbon::isOpen()) {
  echo "Open for the next " . Carbon::nextClose()->diffForHumans(NULL, true);
} else {
  echo "Closed " . Carbon::previousClose()->diffForHumans() . ". Open again " . Carbon::nextOpen()->diffForHumans();
}

To accomplish this, there would have to be a way to actually specify the opening and closing hours (and there might be multiple occasions of those on specific days for businesses that open in the morning, close for lunch, open after lunch, and then close at the end of the day).

Perhaps something like this:

<?php

return array(
  Carbon::SUNDAY => false,
  Carbon::MONDAY => [
    '8am' => true,
    '6pm' => false,
  ],
  Carbon::TUESDAY => [
    '8am' => true,
    '6pm' => false,
  ],
  Carbon::WEDNESDAY => [
    '6am' => true,
    '4pm' => false,
  ],
  Carbon::THURSDAY => [
    '8am' => true,
    '4pm' => false,
  ],
  Carbon::FRIDAY => [
    '10am' => true,
    '2pm' => false,
  ],
  Carbon::SATURDAY => [
    '8am' => true,
    '12pm' => false,
    '2pm' => true,
    '6pm' => false,
  ],
);

Another function that would be useful is schedule where you pass a Carbon object and it returns an array or object of schedule events for the current (or specified) date.

>>> Carbon::schedule(Carbon::tomorrow())
=> [
     "2018-04-28T08:00:00+00:00" => true,
     "2018-04-28T12:00:00+00:00" => false,
     "2018-04-28T14:00:00+00:00" => true,
     "2018-04-28T18:00:00+00:00" => false,
   ]

No Indonesian Holidays?

I assume the region name for Indonesia would be id-national, but I can't find the id-national file in src/Cmixin/Holidays.
Is Indonesia supported yet? If not, I could make the holidays file.

I have problem saturday in april

The problem is with the month of April where you are calculating a holiday Sunday where it is not according to the 2021 calendar of Colombia, there is some way or configuration to fix it.

image

Also identify the problem in another month and year as you can see in:
Holiday: 2021-03-28 17:15:27: Palm Sunday
Holiday: 2022-04-10 17:18:52: Palm Sunday

Code used:

$baseList = 'co-national'; // or region such as 'us-il'

$additionalHolidays = [
    'boss-birthday'    => '09-26', // Close the office on September 26th
];

BusinessDay::enable('Carbon\Carbon', $baseList, []);

// Carbon::setHolidaysRegion('co');
$date = Carbon::now();
$date = Carbon::createFromFormat('Y-m-d', '2021-03-31');

$n = 0;
$days = 10;
while ($n < $days) {

  if ( !$date->isHoliday() ) {
    echo 'BD: '.$date."\n";
    echo "\n";
    $n++;
  } else {
    echo  'Holiday: '.$date.': '.$date->getHolidayName()."\n";
    echo "\n";
  }
  
  $date->add(1, 'day');
}


echo Carbon::parse('2022-04-17 00:00:00')->isHoliday(); // true

echo "\n\n";
echo  $date;
echo "\n";
echo  $n;

echo "\n\n";

Beforehand thank you very much.

Easter Monday in AU-WA not recognised

Hello,
Just recently we observed Easter Monday as a public holiday in au-wa on the 22nd April 2019

However after seeing an inconsistency in a report we noticed that this day was not recognised as a holiday by the package. I've been able to manually add it since, but do you have any ideas why it wasn't picked up?

Thanks

Undefined method parse

Thanks for creating this.

I use the https://github.com/bmewburn/vscode-intelephense language server and whenever I pull in this package in my laravel project none of the original carbon methods are recognized anymore.

The most prominent example is calling Carbon::parse(), which will give me a undefined method parse warning.

Here's how to reproduce.

composer create-project laravel/laravel example-app
cd example-app
composer require cmixin/business-day

Then simply edit the App\Models\User.php file, create a new method such as:

public function item()
{
    Carbon::parse();
}

You'll get the warning: 'Undefined method parse'

If you need more info, please let me know.

Business days are not accurate for some countries

Holidays seem to be wrong for some countries.
E.g., Feb 14th is Valentine's Day in Belgium, but it's not a holiday even though it's a special day.
Also checked the holidays for Cyprus, and there are extra holidays there too. This causes problems with business days, "next business day" or "add/sub business days" methods are inaccurate because of this.

Using Yasumi as the reference, here's the list of Belgian holidays in 2023 (Verified by colleagues living in Belgium):

01.01.2023
09.04.2023
10.04.2023
01.05.2023
18.05.2023
28.05.2023
29.05.2023
21.07.2023
15.08.2023
01.11.2023
11.11.2023
25.12.2023

and this is what we get from business-day (national):

01.01.2023
06.01.2023
14.02.2023
09.04.2023
10.04.2023
01.05.2023
14.05.2023
18.05.2023
28.05.2023
29.05.2023
21.07.2023
15.08.2023
01.11.2023
02.11.2023
11.11.2023
15.11.2023
06.12.2023
25.12.2023

The demo is broken

When I follow the Live Editor link I see an error in the output:

Error: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

preg_replace() is not used in this code so it looks like there's an issue with the version of PHP or the library.

The link is there.

Cannot get expression to work properly

Hi,

I am trying to set a holiday that if it falls on a sunday, the following monday will be a holiday.

return [
    'hari-raya-puasa' => '= 1 shawwal if sunday then next monday', 
]

But got this error

Carbon\Exceptions\InvalidFormatException
DateTime::__construct(): Failed to parse time string (1 shawwal 2020) at position 0 (1): Unexpected character

What is the right way to achieve it?

Other result after upgrade from 1.2.0 to 1.3.0

I have the following code (in Laravel app):

        BusinessDay::enable(\Illuminate\Support\Carbon::class);
        Carbon::setHolidaysRegion('fr-national');
        dd(Carbon::parse('2018-01-06 12:00:00')->isHoliday());

In version 1.2.0 result of this is true. However after upgrade to 1.3.0 result is false. Is there anything that should be changed to use version 1.3 or maybe this is a bug?

Carbon 3: Method diffInBusinessdays does not exist

I got this error on both my Laravel 11 app, and the Sandbox environment produce the same error: Method diffInBusinessdays does not exist

It's working if you are using Carbon v2 in the Sandbox environment, but the latest Carbon 3 version fails when calling this method.

Screenshot 2024-04-02 at 22 16 55

Laravel Vapor Integration

Hi, recently we switched to Laravel Vapor. We're using your lib within a CLI command which we can trigger manually on Laravel Vapor. Unfortunately, the following error is thrown:

Symfony\Component\Debug\Exception\FatalThrowableError
4:59:06 PM
Call to undefined function Cmixin\BusinessDay\easter_days()
/var/task/vendor/cmixin/business-day/src/Cmixin/BusinessDay/HolidayCalculator.php:92

I am not able to reproduce it locally. Within the CLI Command, we enable the business day plugin like so:

BusinessDay::enable(Carbon::class, $this->option('holiday-list'));

$this->option('holiday-list') refers to de-hh. Later in the process, we trigger ::isHoliday().

As I said, I am not able to reproduce it locally. Is this something related to the whole serverless thing? Any ideas? Every help would be great.

Usage with Laravel

Hi,

Great library, thanks!

I am trying to use it with Laravel and the instructions are a bit confusing.

I created the carbon.php config file as instructed in the readme, but this alone is not enough to enable it in Laravel.

I also added the following to my composer.json file as shown in #29 with no luck

  "extra": {
    "laravel": {
      "providers": [
        "Cmixin\\BusinessDay\\BusinessDayServiceProvider"
      ]
    }
  }

same with

  "extra": {
    "laravel": {
      "providers": [
        "Cmixin\\BusinessDay\\Laravel\\ServiceProvider"
      ]
    }
  }

The only thing that worked was to manually add the ServiceProvider in the providers section of app.php:

\Cmixin\BusinessDay\Laravel\ServiceProvider::class,

Is it the expected behavior?

Holiday detected as wednesday when really is Thursday

I like to request a pull to update ar-national, but when I put this holiday sust

'guemes-day' => '= 06-17 if Tuesday,Wednesday then previous Monday and if Thursday,Friday then next Monday',
is sustitute with 15 (previus) when the real sust is 22-06-2021 (next)

I dont know if Carbon or your lib.......... sorry if Iḿ heavy::::::::

How can I make a day of the week a non-business day?

Forgive me if this is a dumb question, but is there a simple way to make a day of the week a non-business day?

I'd like the option of configuring additional weekdays as non-business, i.e every Tuesday and Thursday, for example.

Am I barking up the wrong tree trying to do this with this mixin?

Type hinting bug in previousBusinessDay

Bug in initiated and static types. Specifically the method previousBusinessDay. Code hinting suggests that the methods returns a boolean. I've tested it and found it returned a carbon instance (as expected).

version 1.7.2

Add Juneteenth to US national holidays

Juneteenth will be observed as a national holiday starting on 2022 on Sunday, June 19th (observed on the 20th).

Edit: Full name - Juneteenth National Independence Day

Programatically get a list of available regions

It would be really handy if we were able to programatically get a list of available regions, instead of having to read available files from src/Cmixin/Holidays/.

E.g.,

Carbon::getHolidayRegions(); // ['ad-07', 'ad-national', 'ae-national', ... ] ...etc

Getting a list of holidays in parsable carbon format

Hi there, great effort here! Thanks!

May I ask if there is any way of getting a list of all holidays in a format that can be parsed by carbon?

Looks like getHolidays() returns an array of key values that carbon can not parse.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.