Hi,

I'm currently migrating from ZF1 to ZF2, and I have some trouble in creating
forms, one of them is I cannot properly set the date format for the DateTime
element I am trying to do sth like this (i've changed it a few times but its
just to get the idea)

                $date = new \DateTime();
                $date_formated = $date->format('d/m/Y H:i');
                
                
                $this->add ( array (
                                'name' => 'registration_starts',
                                'type' => 'Zend\Form\Element\DateTime',
                                'options' => array (
                                                'format'=>'d/m/Y H:i',
                                                'label' => 'Registration start 
Date/Time',
                
                                ),
                                'attributes' => array (
                                                'value'=> $date_formated,
                                                'class'=>'datetime picker',
                                                'min' => $date->sub(new 
\DateInterval('PT30M'))->format('d/m/Y H:i'),
                                                'max' => $date->add(new 
\DateInterval('P1Y'))->format('d/m/Y H:i'),
                                                'step' => '1',
                                )
                )
                );
                $this->get('trn_registration_starts')->setFormat('d/m/Y H:i');

and with such element I get error "Invalid date param given" from the
Zend/Validator/DateStep.php:234, how should it be done?

In future I'd also like to set the date format from the users locale;>




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Zend-Form-Element-DateTime-problem-with-data-format-tp4657657.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to