定制 webtoucher/calendar 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

webtoucher/calendar

最新稳定版本:1.1.2

Composer 安装命令:

composer require webtoucher/calendar

包简介

Library for advanced operations with calendar days.

README 文档

README

This library helps to calculate date difference considering holidays.

Latest Stable Version Total Downloads Daily Downloads Latest Unstable Version License

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require webtoucher/calendar "*"

or add

"webtoucher/calendar": "*"

to the require section of your composer.json file.

Usage

Create calendar for your country:

$calendar = new Calendar(new Schedule('ru'));

Also you can use your external rules. Just create directory with your rules - e.x. 2016.json or default.json. Default rules will be used when rules for the year not exists. Use directory fullpath to init schedule.

$calendar = new Calendar(new Schedule('/var/www/my-site/rules/pl'));

Calculate number of working days with one of follow ways:

echo $calendar->calendarToWorkingDays(new \DateTime('2016-02-24'), new \DateTime('2016-02-29')); // 3
echo $calendar->calendarToWorkingDays(new \DateTime('2016-02-29'), new \DateTime('2016-02-24')); // -3
echo $calendar->calendarToWorkingDays(new \DateTime('2016-02-24'), 5); // 3
echo $calendar->calendarToWorkingDays(new \DateTime('2016-02-29'), -5); // -3

Calculate number of calendar days by working days with one of follow ways:

echo $calendar->workingToCalendarDays(new \DateTime('2016-02-24'), 3); // 5
echo $calendar->workingToCalendarDays(new \DateTime('2016-02-29'), -3); // -5

Additional information

You can help the project by adding rules for another countries. Send me your pull requests. But please use the same formating for json files.

统计信息

  • 总下载量: 3.22k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-03-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固