Description
WeekType
form field that allows users to modify data that represents a
specific ISO 86011 week number
Syntax
use Symfony\Component\Form\Extension\Core\Type\WeekType;
$builder->add('startDateTime', WeekType::class, [
// use this if you store week numbers as strings ('2011-W17')
'input' => 'string',
// use this if you store week numbers as arrays (e.g. [2011, 17])
'input' => 'array',
// renders two <select> to select the year and week number
'widget' => 'choice',
// renders two <input type="text"> to write the year and week number
'widget' => 'text',
// renders a <input type="week"> which is properly rendered by most browsers
'widget' => 'single_text',
]);