PHPackages                             traderinteractive/filter-dates - 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. traderinteractive/filter-dates

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

traderinteractive/filter-dates
==============================

A filtering implementation for verifying dates

v4.0.0(3y ago)1102.7k↓49%32MITPHPPHP ^7.3 || ^8.0CI failing

Since Mar 6Pushed 3y ago7 watchersCompare

[ Source](https://github.com/traderinteractive/filter-dates-php)[ Packagist](https://packagist.org/packages/traderinteractive/filter-dates)[ RSS](/packages/traderinteractive-filter-dates/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (3)Versions (4)Used By (2)

filter-dates-php
================

[](#filter-dates-php)

[![Build Status](https://camo.githubusercontent.com/5bbeee2576d26ceaedce957cc0672ebd1e7e960928cc86388e3b013e5e56bd59/68747470733a2f2f7472617669732d63692e6f72672f747261646572696e7465726163746976652f66696c7465722d64617465732d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/traderinteractive/filter-dates-php)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/cd987d6e4837249622935b3ce4c363fe773308783d7e023a419b27667042e15d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f747261646572696e7465726163746976652f66696c7465722d64617465732d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/traderinteractive/filter-dates-php/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/a18d096bf2fecaec42be45fc17601754265a2112080d40f81550979c90e41d78/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f747261646572696e7465726163746976652f66696c7465722d64617465732d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/traderinteractive/filter-dates-php?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/2236484a00abbc672abe4fd62cddfd53984fafa4afcdc34039192a9f399f3158/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d64617465732f762f737461626c65)](https://packagist.org/packages/traderinteractive/filter-dates)[![Latest Unstable Version](https://camo.githubusercontent.com/c22cdbb57e79b2dc8024da9a150b7d0d6fd64afb4c78af3de849a2c0eef9ddba/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d64617465732f762f756e737461626c65)](https://packagist.org/packages/traderinteractive/filter-dates)[![License](https://camo.githubusercontent.com/248abe61e70b34f33297cc0fe142c27e64a4afb79d460a291fb1bbf4c500e006/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d64617465732f6c6963656e7365)](https://packagist.org/packages/traderinteractive/filter-dates)

[![Total Downloads](https://camo.githubusercontent.com/1353ae8fc025700dbabdfeaa4667454a66e783668c6837536b14333d446aa3af/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d64617465732f646f776e6c6f616473)](https://packagist.org/packages/traderinteractive/filter-dates)[![Daily Downloads](https://camo.githubusercontent.com/e9e8cfe63dac808711908b4e118d354aa9b6a777012eccce4cb2241c8a3d596d/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d64617465732f642f6461696c79)](https://packagist.org/packages/traderinteractive/filter-dates)[![Monthly Downloads](https://camo.githubusercontent.com/7275d1c783b7001f90e02b86073311142ba836b2b89296422e6fb9121b0ca90c/68747470733a2f2f706f7365722e707567782e6f72672f747261646572696e7465726163746976652f66696c7465722d64617465732f642f6d6f6e74686c79)](https://packagist.org/packages/traderinteractive/filter-dates)

A filtering implementation for verifying correct data and performing typical modifications to common date objects.

Requirements
------------

[](#requirements)

Requires PHP 7.0 or newer and uses composer to install further PHP dependencies. See the [composer specification](composer.json) for more details.

Composer
--------

[](#composer)

To add the library as a local, per-project dependency use [Composer](http://getcomposer.org)! Simply add a dependency on `traderinteractive/filter-dates` to your project's `composer.json` file such as:

```
composer require traderinteractive/filter-dates
```

### Functionality

[](#functionality)

#### DateTime::filter

[](#datetimefilter)

This will filter the value as a `\DateTime` object. The value can be any string that conforms to [PHP's valid date/time formats](http://php.net/manual/en/datetime.formats.php)

The following checks that `$value` is a date/time.

```
$dateTime = \TraderInteractive\Filter\DateTime::filter('2014-02-04T11:55:00-0500');
```

#### DateTime::format

[](#datetimeformat)

This will filter a given `\\DateTime' value to a string based on the given format.

The following returns formatted string for a given `\DateTime` `$value`

```
$formatted = \TraderInteractive\Filter\DateTime::format($value, 'Y-m-d H:i:s');
```

#### DateTimeZone::filter

[](#datetimezonefilter)

This will filter the value as a `\DateTimeZone` object. The value can be any [supported timezone name](http://php.net/manual/en/timezones.php)

The following checks that `$value` is a timezone

```
$timezone = \TraderInteractive\Filter\DateTimeZone::filter('America/New_York');
```

#### TimeOfDayFilter::filter

[](#timeofdayfilterfilter)

This will filter values as a time-of-day string in the format of `HH:MM:SS`

The following checks that `$value` is a valid time-of-day string

```
$timeOfDay = \TraderInteractive\Filter\TimeOfDayFilter::filter('12:00:59');
```

Contact
-------

[](#contact)

Developers may be contacted at:

- [Pull Requests](https://github.com/traderinteractive/filter-dates-php/pulls)
- [Issues](https://github.com/traderinteractive/filter-dates-php/issues)

Project Build
-------------

[](#project-build)

With a checkout of the code get [Composer](http://getcomposer.org) in your PATH and run:

```
composer install
./vendor/bin/phpcs
./vendor/bin/phpunit
```

For more information on our build process, read through out our [Contribution Guidelines](CONTRIBUTING.md).

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 76.5% 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 ~832 days

Total

3

Last Release

1375d ago

Major Versions

v3.1.0 → v4.0.02022-09-27

PHP version history (2 changes)v3.0.0PHP ^7.0

v4.0.0PHP ^7.3 || ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29952359?v=4)[Trader Interactive](/maintainers/traderinteractive)[@traderinteractive](https://github.com/traderinteractive)

---

Top Contributors

[![chadicus](https://avatars.githubusercontent.com/u/1182337?v=4)](https://github.com/chadicus "chadicus (13 commits)")[![chrisryan](https://avatars.githubusercontent.com/u/704326?v=4)](https://github.com/chrisryan "chrisryan (4 commits)")

---

Tags

utilitydatetimedatedatestimezoneDateTimeZone

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/traderinteractive-filter-dates/health.svg)

```
[![Health](https://phpackages.com/badges/traderinteractive-filter-dates/health.svg)](https://phpackages.com/packages/traderinteractive-filter-dates)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k430.4M1.7k](/packages/nette-utils)[brick/date-time

Date and time library

3663.8M108](/packages/brick-date-time)[league/period

Time range API for PHP

7335.8M24](/packages/league-period)[aeon-php/calendar

PHP type safe, immutable calendar library

20810.4M16](/packages/aeon-php-calendar)[dater/dater

Compact PHP library for working with date/time in different formats &amp; timezones.

14484.2k](/packages/dater-dater)[fresh/datetime

PHP library that provides additional functions for processing dates &amp; times.

18621.6k3](/packages/fresh-datetime)

PHPackages © 2026

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