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

[mbezhanov/faker-provider-collection

A collection of custom providers for the Faker library

2138.6M24](/packages/mbezhanov-faker-provider-collection)[internal/destroy

55870.4k7](/packages/internal-destroy)[guava/filament-clusters

Filament clusters allow you to cluster multiple fields into one visually.

15881.9k1](/packages/guava-filament-clusters)[m6web/statsd

Component easing the statsd usage

131.0M2](/packages/m6web-statsd)[astrotomic/php-conditional-proxy

This package provides a trait and class to allow calling methods based on a condition without breaking the method chain.

30155.8k5](/packages/astrotomic-php-conditional-proxy)[devtical/nova-qrcode-field

Nova QR code field

4560.6k2](/packages/devtical-nova-qrcode-field)

PHPackages © 2026

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