Statistics
2434
2
0
348d
Badges
Dependencies

Date/DateTime control for Nette Framework

Build Status Code Coverage SensioLabsInsight Status Latest Stable Version Composer Downloads Dependency Status

Requirements

  • Nette >=2.3.0 (2.3.x support will be removed on 31 Jan 2017)
  • PHP >=5.5.0 (5.5.x support will be removed on 10 Jul 2016)

Installation

composer require nella/forms-datetime

Usage


$form = new \Nette\Forms\Form;
$form->addComponent(new \Nella\Forms\DateTime\DateInput('Date'), 'date');
$form->addComponent(new \Nella\Forms\DateTime\DateTimeInput('DateTime'), 'datetime');

// or

\Nella\Forms\DateTime\DateInput::register();
$form->addDate('date', 'Date', 'Y-m-d');

\Nella\Forms\DateTime\DateTimeInput::register();
$form->addDateTime('datetime', 'DateTime', 'Y-m-d', 'G:i');

// Optional date[time] validation
$form['date']
	->addCondition(\Nette\Application\UI\Form::FILLED)
		->addRule([$form['date'], 'validateDate'], 'Date is invalid');

$form['datetime']
	->addCondition(\Nette\Application\UI\Form::FILLED)
		->addRule([$form['datetime'], 'validateDateTime'], 'Date time is invalid');

Manual rendering

{form myForm}
	{label date /}
	{input date}

	{label datetime /}
    {input datetime:date}
    {input datetime:time}
{/form}

License

Date/DateTime control for Nette Framework is licensed under the MIT License - see the LICENSE file for details

  • v2.4.3 2.4.3

    • Fix compatibility with Nette 2.4 (d0b421f)
  • v2.4.2 2.4.2

    • Fix compatibility with Nette 2.4 (d3890aa)
  • v2.4.1 2.4.1

    • typos
  • v2.4.0 2.4.0

    • added Nette 2.4.x support
    • fixed PHP 7.0 compatability
    • improve CS
  • v2.3.0 2.3.0

    • less strict validator
    • add default time option
    • required validates date/datetime
  • v2.2.0 2.2.0

    • fix validation if date or time is not filled
    • add short hour sanitizer
  • v2.1.1 2.1.1

    • small refactoring
    • 100% coverage
  • v2.1.0 2.1.0

    • add attributes support
  • v2.0.0 2.0.0

    • add Nette 2.3.x support
    • stricter validation

    and add CS check and coverage reporting

  • v1.0.0 nette/forms

    require just nette/forms (2.2+)

  • v0.9.0 nette/nette

    initial release

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com