With the recently released version of Zend Framework 2 , two new form elements have been added ; DateSelectand MonthSelect. I want to use the first, which adds three choices; day, month and year. However, I have a problem with formatting the output as I want - and there is no documentation for this!
I add a form element to my form like this (taken from on this page ):
$this->add(array(
'type' => 'Zend\Form\Element\DateSelect',
'name' => 'birthDate',
'options' => array(
'label' => 'Date',
'create_empty_option' => true,
'day_attributes' => array(
'data-placeholder' => 'Day',
'style' => 'width: 20%',
),
'month_attributes' => array(
'data-placeholder' => 'Month',
'style' => 'width: 20%',
),
'year_attributes' => array(
'data-placeholder' => 'Year',
'style' => 'width: 20%',
)
)
));
To output, I do this:
echo $this->formDateSelect($form->get('birthDate'));
The fact is, I donβt know how to control the way formatting selections. For example, they are currently displayed in this form: [month] [day], [year]. I want to change two things; firstly, I want to switch the day and month, and secondly, I want to get rid of the comma.
IntlDateFormatter . , __invoke() [ ], :
echo $this->formDateSelect($form->get('birthDate'), IntlDateFormatter::SHORT);
, .
, , formSelect , . ; .
- , , ? , ?