twix / carbon
这是 briannesbitt/carbon 的包装器,同时也计算法国银行的假日。
1.0.0
2020-06-20 22:32 UTC
Requires
- php: ^7.1
- nesbot/carbon: ^2.35
Requires (Dev)
- phpunit/phpunit: ^7.5
This package is auto-updated.
Last update: 2024-09-21 20:46:28 UTC
README
FR Bank Holidays 对 Carbon 的支持
这扩展了 Carbon 并计算法国银行的假日。
注意:目前仅支持 Carbon v2
用其他语言阅读: 法语
安装
composer require twix/carbon
示例
// Checks if the given date is bank holiday Carbon::isBankHoliday('2020-05-21'); // true Carbon::isBankHoliday(Carbon::parse('First day of 2000')); // true Carbon::getEasterMonday(2021); // '2021-04-05' Carbon::getWhitMonday(2021); // '2021-05-24' // Without any parameter will return date for the current year Carbon::getAscensionThursday(); // '2020-05-21' // Get all bank holidays for one year array_map(function (Carbon $carbon): string { return $carbon->format('Y-m-d'); }, Carbon::getAllBankHolidaysForOneYear(2021)); /* [ '2021-01-01', '2021-04-05', '2021-05-01', '2021-05-08', '2021-05-13', '2021-05-24', '2021-07-14', '2021-08-15', '2021-11-01', '2021-11-11', '2021-12-25' ] */
贡献
- 克隆存储库并安装依赖项。
docker-compose run --rm php /usr/local/bin/composer install
- 运行测试
docker-compose run --rm php vendor/bin/phpunit