ealore/dateinterval 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

ealore/dateinterval

Composer 安装命令:

composer require ealore/dateinterval

包简介

This class extends PHP's \DateInterval class providing weeks+days and negative spec support

README 文档

README

Build Status

Ealore\DateInterval

This is an extension of PHP's \DateInterval with new methods and support for interval specification with both weeks and days at the same time, while in the standard implementation it's possible to use either.

Usage

<?php

use Ealore\DateInterval;

$interval = new DateInterval('P5W1D');
// with this implementation it is possible to specify both weeks and days in the same specification string

echo $interval->w; // outputs 5
echo $interval->d; // outputs 1

legacy() returns an instance compatible with PHP's \DateInterval

$legacy = $di->legacy();

echo $legacy->w; // outputs 0
echo $legacy->d; // outputs 36

getIntervalSpec() returns the interval specification string

$interval = new DateInterval('P5W1D');

echo $interval->getIntervalSpec(); // outputs P5W1D


$zero_interval = new DateInterval('P0D');

echo $interval->getIntervalSpec(); // outputs P0D

Installation

$ composer require ealore/dateinterval

Changelog

version 1.0.3

  • added a check to avoid an 'unknown or bad format' exception

version 1.0.2

  • bugfix

version 1.0.1

  • added a check to getIntervalSpec()

version 1.0

  • added w property
  • added legacy() method to fetch an instance of PHP's \DateInterval
  • added getIntervalSpec() that returns the interval specification string. If the interval duration is 0, the original interval_spec is returned.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固