PHPackages                             livioribeiro/nette-datetimefields - 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. livioribeiro/nette-datetimefields

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

livioribeiro/nette-datetimefields
=================================

Form component for date, time and datetime inputs with automatic conversion to DateTime.

06.2k1PHP

Since Apr 7Pushed 12y ago1 watchersCompare

[ Source](https://github.com/livioribeiro/NetteDateTimeFields)[ Packagist](https://packagist.org/packages/livioribeiro/nette-datetimefields)[ RSS](/packages/livioribeiro-nette-datetimefields/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

NetteDateTimeFields
===================

[](#nettedatetimefields)

Form component for date, time and datetime inputs with automatic conversion to DateTime.

Setup
-----

[](#setup)

Add the DateTimeFormExtension to your config.neon

```
extensions:
  - NetteDateTimeFields\DateTimeFormExtension
```

or call `register` method in bootstrap.php

```
use NetteDateTimeFields\DateTimeFormExtension
DateTimeFormExtension::register();
```

Usage
-----

[](#usage)

Simply call `addDate()`, `addTime()` or `addDateTime()` on the Form object:

```
$form = new Nette\Application\UI\Form();
$form->addDate('date', 'date', $format = 'd/m/Y');
$form->addTime('time', 'time', $format = 'H:i');
$form->addDateTime('dateTime', 'dateTime', $dateFormat = 'd/m/Y', $timeFormat = 'H:i', $separator = ' ')
```

You can also add a range validation:

```
use NetteDateTimeFields\Controls\DateTimeBase;

$form = new Nette\Application\UI\Form();
$form->addDate('date', 'date', 'Y-m-d')
    ->addRule(DateTimeBase::DATETIME_RANGE, 'message',
        ['1970-01-01', '2070-01-01']); // \DateTime or string
$form->addTime('time', 'time')
    ->addRule(DateTimeBase::DATETIME_RANGE, 'message',
        ['08:00', '16:30']);
$form->addDateTime('dateTime', 'dateTime')
    ->addRule(DateTimeBase::DATETIME_RANGE, 'message',
        ['01/01/1970', '01/01/2070']);
```

The parameters can be either a \\DateTime object or a string formatted accondingly to the format specified.

DateTime range validation can receive 4 parameters, which the third and fourth validates the time range of the given date. The following will not validate, for example, a date and time like '01/01/2010 07:00'.

```
$form->addDateTime('dateTime', 'dateTime')
    ->addRule(DateTimeBase::DATETIME_RANGE, 'message',
        ['01/01/1970', '01/01/2070', '08:00', '16:30']);
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9b7de5f9f8547b1c3fb8934190cfb054add752805be53606ee26c4dd8edda362?d=identicon)[livioribeiro](/maintainers/livioribeiro)

### Embed Badge

![Health badge](/badges/livioribeiro-nette-datetimefields/health.svg)

```
[![Health](https://phpackages.com/badges/livioribeiro-nette-datetimefields/health.svg)](https://phpackages.com/packages/livioribeiro-nette-datetimefields)
```

PHPackages © 2026

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