PHPackages                             professional-wiki/edtf - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. professional-wiki/edtf

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

professional-wiki/edtf
======================

PHP library to parse, represent and work with dates that follow the Extended Date/Time Format specification.

3.1.0(9mo ago)10462.7k↓19.2%7[14 issues](https://github.com/ProfessionalWiki/EDTF/issues)[2 PRs](https://github.com/ProfessionalWiki/EDTF/pulls)4GPL-2.0-or-laterPHPPHP ^7.4|^8CI passing

Since Mar 18Pushed 4d ago9 watchersCompare

[ Source](https://github.com/ProfessionalWiki/EDTF)[ Packagist](https://packagist.org/packages/professional-wiki/edtf)[ GitHub Sponsors](https://github.com/JeroenDeDauw)[ RSS](/packages/professional-wiki-edtf/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (5)Versions (14)Used By (4)

EDTF PHP Library
================

[](#edtf-php-library)

[![GitHub Workflow Status](https://camo.githubusercontent.com/a3b7dfb4d35349813da2c4b203f7edb388ec2adabb6bdebc6470df6ccf69065c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f50726f66657373696f6e616c57696b692f454454462f63692e796d6c3f6272616e63683d6d6173746572)](https://github.com/ProfessionalWiki/EDTF/actions?query=workflow%3ACI)[![Type Coverage](https://camo.githubusercontent.com/3130c8af371e98fd9ed47fb158821b7087cbd784ca4d50919c9de4b507472c24/68747470733a2f2f73686570686572642e6465762f6769746875622f50726f66657373696f6e616c57696b692f454454462f636f7665726167652e737667)](https://shepherd.dev/github/ProfessionalWiki/EDTF)[![codecov](https://camo.githubusercontent.com/e2debe56264959276038df6bcc10685fd574fed8152ad0e3252321bd737301bc/68747470733a2f2f636f6465636f762e696f2f67682f50726f66657373696f6e616c57696b692f454454462f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d476e4f4733464631365a)](https://codecov.io/gh/ProfessionalWiki/EDTF)[![Latest Stable Version](https://camo.githubusercontent.com/1b134385481299f3cc5bc4c55c1b66c0f7bf6cdc5cd4a1808e5afcafeb892ed3/68747470733a2f2f706f7365722e707567782e6f72672f70726f66657373696f6e616c2d77696b692f656474662f762f737461626c65)](https://packagist.org/packages/professional-wiki/edtf)[![Download count](https://camo.githubusercontent.com/7b89948b2ae5a7d215d928eecec9d42624dfd70823bd42be8cadb02d1b8bdc70/68747470733a2f2f706f7365722e707567782e6f72672f70726f66657373696f6e616c2d77696b692f656474662f646f776e6c6f616473)](https://packagist.org/packages/professional-wiki/edtf)[![License](https://camo.githubusercontent.com/50c7c86f147d47ad919bc2d4a5160615fd62ba149f6d63333523d6cd1e6dcdb3/68747470733a2f2f706f7365722e707567782e6f72672f70726f66657373696f6e616c2d77696b692f656474662f6c6963656e7365)](LICENSE)

EDTF PHP is a small library for parsing, representing, and working with the [Extended Date/Time Format](https://www.loc.gov/standards/datetime/) specification.

[Professional Wiki](https://professional.wiki) created and maintains EDTF. The Luxembourg Ministry of Culture funded the [initial development](https://www.wikibase.consulting/wikibase-edtf/). This library is an open-source project, so contributions are welcome! You can also commission [software development](https://professional.wiki/en/mediawiki-development) via Professional Wiki.

- [Usage](#usage)
    - [Parsing](#parsing)
    - [Validating](#validating)
    - [Humanizing](#humanizing)
    - [Object model](#object-model)
- [EDTF support and limits](#edtf-support-and-limits)
- [Installation](#installation)
- [Development](#development)
- [Release notes](#release-notes)

Usage
-----

[](#usage)

### Parsing

[](#parsing)

```
$parser = \EDTF\EdtfFactory::newParser();
$parsingResult = $parser->parse('1985-04-12T23:20:30');
$parsingResult->isValid(); // true
$parsingResult->getEdtfValue(); // \EDTF\EdtfValue
$parsingResult->getInput(); // '1985-04-12T23:20:30'
```

### Validating

[](#validating)

```
$validator = \EDTF\EdtfFactory::newValidator();
$validator->isValidEdtf('1985-04-12T23:20:30'); // true
```

### Humanizing

[](#humanizing)

```
$humanizer = \EDTF\EdtfFactory::newHumanizerForLanguage( 'en' );
$humanizer->humanize($edtfValue); // string
```

### Object model

[](#object-model)

```
$edtfValue->getMax(); // int
$edtfValue->getMin(); // int
$edtfValue->covers(\EDTF\EdtfValue $anotherValue); // bool
```

```
$edtfDate->getYear(); // int
$edtfDate->isOpenInterval(); // bool
$edtfDate->getQualification(); // \EDTF\Qualification
```

EDTF support and limits
-----------------------

[](#edtf-support-and-limits)

All level 0, 1 and 2 EDTF formats can be parsed and represented, except for:

- Open ranges with a date (Level 2: Qualification): `..2004-06-01/2004-06-20` (This is supported: `../2004-06-20`)

Humanization has more limits:

- Significant digits (EDTF level 2): `1950S2` (some year between 1900 and 1999, estimated to be 1950)
- Group Qualification (EDTF level 2): `2004-06~-11` (year and month approximate)
- Qualification of Individual Component (EDTF level 2): `?2004-06-~11` (year uncertain; month known; day approximate)
- Level 2 Unspecified Digit: `1XXX-1X` (October, November, or December during the 1000s)

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

[](#installation)

To use the EDTF library in your project, simply add a dependency on professional-wiki/edtf to your project's `composer.json` file. Here is a minimal example of a `composer.json`file that just defines a dependency on EDTF 3.x:

```
{
    "require": {
        "professional-wiki/edtf": "~3.0"
    }
}
```

Development
-----------

[](#development)

Start by installing the project dependencies by executing

```
composer update

```

You can run the tests by executing

```
make test

```

You can run style checks and static analysis by executing

```
make cs

```

To run all CI checks, execute

```
make

```

You can also invoke PHPUnit directly to pass it arguments, as follows

```
vendor/bin/phpunit --filter SomeClassNameOrFilter

```

Release notes
-------------

[](#release-notes)

### Version 3.1.0 - 2025-09-23

[](#version-310---2025-09-23)

- Added support for installation with a newer version of a used date time library (`nesbot/carbon` 3.x)
- Improved translations

### Version 3.0.2 - 2025-05-12

[](#version-302---2025-05-12)

- Improved translations

### Version 3.0.1 - 2024-05-03

[](#version-301---2024-05-03)

- Fixed "Undefined array key" warning when combining approximation qualifiers
- Improved translations

### Version 3.0.0 - 2023-01-18

[](#version-300---2023-01-18)

Functional changes:

- Improved humanization of uncertain and approximate dates
- Improved capitalization in humanization, especially for French
- Various translation updates from TranslateWiki, improving humanization for many languages
- Added support for pluralization in humanization, for use by TranslateWiki

Breaking API changes:

- Removed parameter of `ExtDate::uncertain`
- Removed parameter of `ExtDate::approximate`
- Renamed `FrenchStrategy` to `DefaultStrategy`
- Made `Qualification` constructor arguments required

Further API changes:

- Deprecated `ExtDate::uncertain` in favour of `ExtDate::isUncertain`
- Deprecated `ExtDate::approximate` in favour of `ExtDate::isApproximate`
- Added `Qualification::newFullyKnown`
- Added `Qualification::isFullyKnown`
- Added `Qualification::dayIsKnown`
- Added `Qualification::monthIsKnown`
- Added `Qualification::yearIsKnown`
- Added `Qualification::isUncertain`, replacing `Qualification::uncertain`
- Added `Qualification::dayIsUncertain`
- Added `Qualification::monthIsUncertain`
- Added `Qualification::yearIsUncertain`
- Added `Qualification::isApproximate`, replacing `Qualification::approximate`
- Added `Qualification::dayIsApproximate`
- Added `Qualification::monthIsApproximate`
- Added `Qualification::yearIsApproximate`
- Added `Qualification::isUniform`
- Added `Qualification::monthAndYearHaveTheSameQualification`
- Added `ExtDate::isUniformlyQualified`

### Version 2.0.2 - 2022-04-29

[](#version-202---2022-04-29)

- Improved translations

### Version 2.0.1 - 2022-02-19

[](#version-201---2022-02-19)

- `?` is no longer recognized as valid date

### Version 2.0.0 - 2021-04-28

[](#version-200---2021-04-28)

- Fixed performance issue for sets with large range elements like `1000-01-01..2000-12-30`
- Fixed humanization of sets with more than one element, of which at least one an open range
- Improved humanization of sets with range elements like `2000..2010`
- Intervals and set ranges with end dates earlier than their start dates are now rejected
- Various breaking changes to the `Set` class
    - Constructor signature changed
    - Removed `hasOpenStart` and `hasOpenEnd`
    - Removed `isSingleElement`
- Added `Set::isEmpty`
- Added `Set::getElements`
- Added `SetElement` interface with implementations
    - `OpenSetElement`
    - `RangeSetElement`
    - `SingleDateSetElement`
- `ExtDate::precision` and `Season::precision` are now guaranteed to return an integer
- `precisionAsString` in `ExtDate` and `Season` is now guaranteed to return a non-empty string

### Version 1.3.0 - 2021-04-26

[](#version-130---2021-04-26)

- Fixed season support in intervals
- Fixed parsing of open sets with an extra space like `{ ..2021}` (thanks @chaudbak)
- Added `ExtDate::iso8601` and `ExtDateTime::iso8601` (thanks @seth-shaw-unlv)
- Added `ParsingResult::getErrorMessage`

### Version 1.2.0 - 2021-04-16

[](#version-120---2021-04-16)

- Improved humanization of open sets

### Version 1.1.0 - 2021-03-20

[](#version-110---2021-03-20)

- Added internationalization to the `StructuredHumanizer` service
- Fixed handling of "year 0"

### Version 1.0.0 - 2021-03-19

[](#version-100---2021-03-19)

- [Initial release](https://www.wikibase.consulting/wikibase-edtf/) with
    - Support for EDTF levels 0, 1 and 2
    - Parsing
    - Object model
    - Internationalized humanization
    - Validation service
    - Example data

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance61

Regular maintenance activity

Popularity44

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 51.1% 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 ~164 days

Recently: every ~310 days

Total

11

Last Release

284d ago

Major Versions

1.3.0 → 2.0.02021-04-28

2.0.2 → 3.0.02023-01-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/451bd4039d530fed8f9c3da91bfa519233a397d2182cdfdcad700f6cfea19b7f?d=identicon)[Jeroen De Dauw](/maintainers/Jeroen%20De%20Dauw)

![](https://avatars.githubusercontent.com/u/1104078?v=4)[Karsten Hoffmeyer](/maintainers/kghbln)[@kghbln](https://github.com/kghbln)

---

Top Contributors

[![JeroenDeDauw](https://avatars.githubusercontent.com/u/146040?v=4)](https://github.com/JeroenDeDauw "JeroenDeDauw (205 commits)")[![chaudbak](https://avatars.githubusercontent.com/u/59545453?v=4)](https://github.com/chaudbak "chaudbak (81 commits)")[![translatewiki](https://avatars.githubusercontent.com/u/24829418?v=4)](https://github.com/translatewiki "translatewiki (69 commits)")[![kilip](https://avatars.githubusercontent.com/u/301065?v=4)](https://github.com/kilip "kilip (25 commits)")[![mzeinstra](https://avatars.githubusercontent.com/u/5627431?v=4)](https://github.com/mzeinstra "mzeinstra (5 commits)")[![thomas-topway-it](https://avatars.githubusercontent.com/u/46287689?v=4)](https://github.com/thomas-topway-it "thomas-topway-it (5 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (3 commits)")[![seth-shaw-unlv](https://avatars.githubusercontent.com/u/29869988?v=4)](https://github.com/seth-shaw-unlv "seth-shaw-unlv (3 commits)")[![DiegoPino](https://avatars.githubusercontent.com/u/6946023?v=4)](https://github.com/DiegoPino "DiegoPino (2 commits)")[![apetushok](https://avatars.githubusercontent.com/u/5189699?v=4)](https://github.com/apetushok "apetushok (1 commits)")[![seth-shaw-asu](https://avatars.githubusercontent.com/u/108362375?v=4)](https://github.com/seth-shaw-asu "seth-shaw-asu (1 commits)")[![malberts](https://avatars.githubusercontent.com/u/1428594?v=4)](https://github.com/malberts "malberts (1 commits)")

---

Tags

date-timeedtfedtf-phpparserphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/professional-wiki-edtf/health.svg)

```
[![Health](https://phpackages.com/badges/professional-wiki-edtf/health.svg)](https://phpackages.com/packages/professional-wiki-edtf)
```

###  Alternatives

[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

3.0k437.5M1.0k](/packages/league-commonmark)[spatie/laravel-sitemap

Create and generate sitemaps with ease

2.6k16.6M147](/packages/spatie-laravel-sitemap)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M984](/packages/statamic-cms)[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.5k10](/packages/helsingborg-stad-municipio)[bitrix24/b24phpsdk

An official PHP library for the Bitrix24 REST API

10244.2k5](/packages/bitrix24-b24phpsdk)[ymirapp/cli

Ymir command-line tool

2621.7k](/packages/ymirapp-cli)

PHPackages © 2026

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