PHPackages                             a2htray/cp-date-fns - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. a2htray/cp-date-fns

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

a2htray/cp-date-fns
===================

copy of javascript lib 'date-fns'

1.0.0(7y ago)032MITPHPPHP &gt;=7.1.0

Since Apr 3Pushed 7y ago1 watchersCompare

[ Source](https://github.com/a2htray/cp-date-fns)[ Packagist](https://packagist.org/packages/a2htray/cp-date-fns)[ Docs](https://github.com/a2htray/cp-date-fns)[ RSS](/packages/a2htray-cp-date-fns/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (2)Used By (0)

The implementation of JavaScript Library `date-fns` by using PHP

Copy from [date-fns](https://github.com/date-fns/date-fns)

Installation
------------

[](#installation)

We can simply add the package into our project by using `Composer` to run the command below:

```
composer require a2htray/cp-date-fns:dev-master
```

Table of methods
----------------

[](#table-of-methods)

MethodDescriptionUtils::addYearsReturn the date added serveral yearsUtils::addQuartersReturn the date add several quartersUtils::addMonthsReturn the date add several monthsUtils::addDaysReturn the date add several daysUtils::addHoursReturn the date add several hoursUtils::addMinutesReturn the date add several minutesUtils::addSecondsReturn the date add serveral secondsUtils::addMillisecondsReturn the date add serveral millisecondsUtils::closeIndexToReturn an index of the closest date from the array comparing to the given dateUtils::compareAscCompare two dates return 1、-1 or 0Utils::compareDescCompare two dates return 1、-1 or 0Utils::differenceInDaysGet the number of full days between two given datesUtils::differenceInHoursGet the number of hours between two given datesUtils::differenceInCalendarDaysGet the number of calendar days between two given datesUtils::differenceInCalendarMonthsGet the number of calendar months between two given datesUtils::differenceInCalendarQuartersGet the number of calendar quarters between two given datesUtils::differenceInCalendarYearsGet the number of calendar years between two given datesUtils::getQuarterReturn the order of the given date in current yearUtils::getMillisecondsReturn the milliseconds of the given dateUtils::startOfDayGet the start date of the given dateUtils::subDaysSubtract serveral days form the given date, then return the date after subtractionUtils::subHoursSubtract serveral hours form the given date, then return the date after subtractionUtils::endOfDayGet the end date of the given dateUtils::endOfDecadeGet the date which is the end date of current decade of the given dateUtils::endOfHourGet the date which is the end date of current hour of the given dateUtils::endOfMonthGet the date which is the end date of current month of the given dateUtils::endOfMinuteGet the date which is the end date of current minute of the given dateUtils::endOfSecondGet the date which is the end date of current second of the given dateUtils::endOfWeekGet the date which is the end date of current week of the given dateUtils::endOfYearGet the date which is the end date of current year of the given dateUtils::endOfQuarterGet the date which is the end date of current quarter of the given dateUtils::isMondayWhether is MondayUtils::isTuesdayWhether is TuesdayUtils::isWednesdayWhether is WednesdayUtils::isThursdayWhether is ThursdayUtils::isFridayWhether is FridayUtils::isSaturdayWhether is SaturdayUtils::isSundayWhether is SundayUtils::isSameDayWhether is same between two given datesUtils::isFirstDayOfMonthWhether is the first day of the monthUtils::isLastDayOfMonthWhether is the last day of the month

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2597d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0503a103b5f94c87bdd5463ed11e96f9804afe4ae492467818a0644a0593b316?d=identicon)[a2htray](/maintainers/a2htray)

---

Top Contributors

[![a2htray](https://avatars.githubusercontent.com/u/12782530?v=4)](https://github.com/a2htray "a2htray (6 commits)")

---

Tags

formaterphptime

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/a2htray-cp-date-fns/health.svg)

```
[![Health](https://phpackages.com/badges/a2htray-cp-date-fns/health.svg)](https://phpackages.com/packages/a2htray-cp-date-fns)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
