protected function createComponentForm()

$form = new Form();
$form->addDate('date', 'Date', DateInput::TYPE_DATE);
$form->addDate('datetimeLocal', 'Local datetime', DateInput::TYPE_DATETIME_LOCAL)
	->setDefaultValue(new DateTimeImmutable())
	->addRule(Form::RANGE, null, array(new DateTimeImmutable('-2 years'), new DateTimeImmutable('+2 years')));
$form->addDate('month', 'Month', DateInput::TYPE_MONTH);
$form->addDate('week', 'Week', DateInput::TYPE_WEEK)
	->setDefaultValue(new DateTimeImmutable())
	->addRule(Form::RANGE, null, array(new DateTimeImmutable('-1 year'), new DateTimeImmutable('+6 months')));
$form->addDate('time', 'Time', DateInput::TYPE_TIME)
	->setDefaultValue(new DateInterval("PT5M3S"));
$form->addSubmit('send', 'Send');
return $form;

{control form}

$form->getValues()

type=date

null

type=datetime-local

DateTimeImmutable #94
date: '2024-11-21 06:11:54.882351' timezone_type: 3 timezone: 'Europe/Prague'

type=month

null

type=week

DateTimeImmutable #112
date: '2024-11-21 06:11:54.882419' timezone_type: 3 timezone: 'Europe/Prague'

type=time

DateTimeImmutable #124
date: '2024-11-21 00:05:03.000000' timezone_type: 3 timezone: 'Europe/Prague'