PHPackages                             sdui/daterange - 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. sdui/daterange

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

sdui/daterange
==============

Provides an Object that contains the DateTimeRange for start and end times. Also provides the opportunity to create the gaps between a scope and multiple intersections.

0.1.2(4y ago)46MITPHPPHP &gt;= 7.2

Since Nov 3Pushed 4y ago3 watchersCompare

[ Source](https://github.com/Sdui-GmbH/daterange)[ Packagist](https://packagist.org/packages/sdui/daterange)[ RSS](/packages/sdui-daterange/feed)WikiDiscussions main Synced 2d ago

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

SDUI daterange
==============

[](#sdui-daterange)

### usage

[](#usage)

#### Initializing

[](#initializing)

```
$beginsAt = new DateTime();
$endsAt = new DateTime();
$dateRange = new DateRange($beginsAt, $endsAt);

```

It may also be initialized with Carbon objects

```
new DateRange(Carbon::yesterday(), Carbon::now())

```

or from laravels helper functions

```
new DateRange(today(), now())

```

#### Gaps

[](#gaps)

It is possible to find gaps between a scope range and intersection ranges

```
/*
 * Scope            |0--------------------------24>
 * Intersection
 * Gaps             {0           				24}
*/
$start = Carbon::make('2021-11-25')->startOfDay();
$end = $start->clone()->endOfDay();
$scope = new DateRange($start, $end);
$gaps = DateRange::gaps($scope, []);

count($gaps); 			// 1
$gaps[0]->getStart(); 	// 2021-11-25 00:00:00
$gaps[0]->getEnd(); 	// 2021-11-25 23:59:59

```

More advanced

```
/*
 * Scope            |0--------------------------24>
 * Intersection     [0           9]
 * Gaps                            {9           24}
*/
$start = Carbon::make('2021-11-25')->startOfDay();
$end = $start->clone()->endOfDay();
$scope = new DateRange($start, $end);
$intersection = new DateRange($start->clone(), $start->clone()->setHour(9));
$gaps = DateRange::gaps($scope, [$intersection]);

count($gaps); 			// 1
$gaps[0]->getStart(); 	// 2021-11-25 00:00:00
$gaps[0]->getEnd(); 	// 2021-11-25 08:59:59

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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

Every ~0 days

Total

3

Last Release

1651d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9151c61b1889feffe94717ece9af0ee6f539e9e2836f08028a0e9d42472f562f?d=identicon)[Sauerbrei](/maintainers/Sauerbrei)

---

Top Contributors

[![Sauerbrei](https://avatars.githubusercontent.com/u/17849159?v=4)](https://github.com/Sauerbrei "Sauerbrei (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sdui-daterange/health.svg)

```
[![Health](https://phpackages.com/badges/sdui-daterange/health.svg)](https://phpackages.com/packages/sdui-daterange)
```

###  Alternatives

[parsecsv/php-parsecsv

CSV data parser for PHP

6885.7M38](/packages/parsecsv-php-parsecsv)[sensiolabs/ansi-to-html

A library to convert a text with ANSI codes to HTML

2537.8M53](/packages/sensiolabs-ansi-to-html)[b13/container

Create Custom Container Content Elements for TYPO3

1823.1M63](/packages/b13-container)[lizhichao/one-sm

国密sm3

1871.4M4](/packages/lizhichao-one-sm)[kornrunner/keccak

Pure PHP implementation of Keccak

1252.7M251](/packages/kornrunner-keccak)[torann/json-ld

Extremely simple JSON-LD markup generator.

149620.7k1](/packages/torann-json-ld)

PHPackages © 2026

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