maximnara / business-days-counter
计算工作日差异。
1.0.0
2019-07-23 13:14 UTC
Requires
- php: >=7.0
- illuminate/config: ^5.0
- laravel/framework: >=5.5
- nesbot/carbon: ^1.39.0
Requires (Dev)
- orchestra/testbench: 3.*
- phpunit/phpunit: 7.*
This package is auto-updated.
Last update: 2024-09-24 01:17:47 UTC
README
返回日期之间的差异,不包含公众假期和周末。适用于不同国家。
安装
在Composer中添加库
composer require maximnara/business-days-counter
开发
如果您正在开发此模块,您可以本地连接此库。
- 将psr-4配置添加到composer.json中
"require": {
...,
"maximnara/business-days-counter": "*"
},
"repositories": [
...,
{
"type": "path",
"url": "../business-days-counter"
}
]
- 将提供者添加到config/app.php中的providers数组中
"providers" => array(
...,
ShowHeroes\LaravelQueueMonitoring\LaravelQueueMonitoringServiceProvider::class,
)
配置
在您的config/services.php中设置以下内容
'business-days-counter' => [
'country' => 'lv',
'working-hours' => [
'from' => 9,
'to' => 18,
'launch-hour' => 14, // This is launch hour start and it goes till 15
],
],
如何使用
use maximnara\BusinessDaysCounter\DatesCounter;
public function __construct(DatesCounter $datesCounter)
{
$this->datesCounter = $datesCounter;
}
public function action()
{
$diffInSeconds = $this->datesCounter->getDifferenceInSeconds($date1, $date2, DateCounter::COUNTRY_FR); // Here only Carbon dates.
}