maarheeze/calendar-date
最新稳定版本:1.1.0
Composer 安装命令:
composer require maarheeze/calendar-date
包简介
a timezone-agnostic calendar date value object
README 文档
README
A timezone-agnostic calendar date value object for PHP. No time component, no timezone concerns.
Requirements
- PHP 8.2+
Installation
composer require maarheeze/calendar-date
Usage
Creating a date
CalendarDate::today(); CalendarDate::parse('2000-01-01'); CalendarDate::parse('today'); CalendarDate::parse('+3 weeks'); CalendarDate::instance($dateTimeInterface); CalendarDate::createFromFormat('d-m-Y', '01-01-2000');
Formatting
$date->format('Y-m-d'); $date->__toString(); // defaults to Y-m-d
Arithmetic
$date->addDays(7); $date->subDays(7); $date->addMonths(1); $date->subMonths(1); $date->addYears(1); $date->subYears(1);
All arithmetic methods return a new CalendarDate instance.
Comparison
$date->equalTo($other); $date->isBefore($other); $date->isAfter($other); $date->isToday(); $date->isPast(); $date->isFuture();
License
MIT
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-06