Zend_Date / Zend_Format_Locale

4 messages Options
Embed this post
Permalink
Tom808

Zend_Date / Zend_Format_Locale

Reply Threaded More More options
Print post
Permalink
Hi,

i would like to allow users to use the locale date format in a form text element.

Since days i struggle wiht Zend_Date / Zend_Format_Locale but can't find a solution.
 
$locale = new Zend_Locale('de_DE'); // and en_US, ....
Zend_Registry::set('Zend_Locale', $locale);

$this->addElement('text', 'date', array(
         'validators' => array(
                array('Date', false, array(Zend_Locale_Format::STANDARD, $locale)),
        ),
        'label'      => 'date',
));

Whatever locale is used the validator reqiured "MM.dd.yyyy" as date. What am i doing wrong?

Thanks a lot for any hints.

Regards
Tom
thomasW

Re: Zend_Date / Zend_Format_Locale

Reply Threaded More More options
Print post
Permalink
Change
Zend_Locale_Format::STANDARD
to
Zend_Date::DATE

to get the default date setting.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message -----
From: "Tom808" <[hidden email]>
To: <[hidden email]>
Sent: Monday, September 14, 2009 11:55 AM
Subject: [fw-i18n] Zend_Date / Zend_Format_Locale


>
> Hi,
>
> i would like to allow users to use the locale date format in a form text
> element.
>
> Since days i struggle wiht Zend_Date / Zend_Format_Locale but can't find a
> solution.
>
> $locale = new Zend_Locale('de_DE'); // and en_US, ....
> Zend_Registry::set('Zend_Locale', $locale);
>
> $this->addElement('text', 'date', array(
> 'validators' => array(
>         array('Date', false, array(Zend_Locale_Format::STANDARD,
> $locale)),
> ),
> 'label'      => 'date',
> ));
>
> Whatever locale is used the validator reqiured "MM.dd.yyyy" as date. What
> am
> i doing wrong?
>
> Thanks a lot for any hints.
>
> Regards
> Tom
> --
> View this message in context:
> http://www.nabble.com/Zend_Date---Zend_Format_Locale-tp25433106p25433106.html
> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.

Tom808

Re: Zend_Date / Zend_Format_Locale

Reply Threaded More More options
Print post
Permalink
Hi Thomas,

thanks for your reply:

Zend_Date::DATE seems not to exist - but Zend_Date::DATES works fine. Thank you very much!!

Fatal error: Undefined class constant 'DATE' in /app/forms/testdate.php on line 22


Is there a way to get the required format (to display the required format if the user uses a wrong one)?

Regards
Tom


thomasW wrote:
Change
Zend_Locale_Format::STANDARD
to
Zend_Date::DATE

to get the default date setting.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message -----
From: "Tom808" <thomas.wahle@wiscore.de>
To: <fw-i18n@lists.zend.com>
Sent: Monday, September 14, 2009 11:55 AM
Subject: [fw-i18n] Zend_Date / Zend_Format_Locale


>
> Hi,
>
> i would like to allow users to use the locale date format in a form text
> element.
>
> Since days i struggle wiht Zend_Date / Zend_Format_Locale but can't find a
> solution.
>
> $locale = new Zend_Locale('de_DE'); // and en_US, ....
> Zend_Registry::set('Zend_Locale', $locale);
>
> $this->addElement('text', 'date', array(
> 'validators' => array(
>         array('Date', false, array(Zend_Locale_Format::STANDARD,
> $locale)),
> ),
> 'label'      => 'date',
> ));
>
> Whatever locale is used the validator reqiured "MM.dd.yyyy" as date. What
> am
> i doing wrong?
>
> Thanks a lot for any hints.
>
> Regards
> Tom
> --
> View this message in context:
> http://www.nabble.com/Zend_Date---Zend_Format_Locale-tp25433106p25433106.html
> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.
thomasW

Re: Zend_Date / Zend_Format_Locale

Reply Threaded More More options
Print post
Permalink
See Zend_Locale_Format::getDateFormat($locale)
(and the manual... all is written in there and we have a very good search
for it)

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message -----
From: "Tom808" <[hidden email]>
To: <[hidden email]>
Sent: Monday, September 14, 2009 12:11 PM
Subject: Re: [fw-i18n] Zend_Date / Zend_Format_Locale


>
> Hi Thomas,
>
> thanks for your reply:
>
> Zend_Date::DATE seems not to exist - but Zend_Date::DATES works fine.
> Thank
> you very much!!
>
> Fatal error: Undefined class constant 'DATE' in /app/forms/testdate.php on
> line 22
>
>
> Is there a way to get the required format (to display the required format
> if
> the user uses a wrong one)?
>
> Regards
> Tom
>
>
>
> thomasW wrote:
>>
>> Change
>> Zend_Locale_Format::STANDARD
>> to
>> Zend_Date::DATE
>>
>> to get the default date setting.
>>
>> Greetings
>> Thomas Weidner, I18N Team Leader, Zend Framework
>> http://www.thomasweidner.com
>>
>> ----- Original Message -----
>> From: "Tom808" <[hidden email]>
>> To: <[hidden email]>
>> Sent: Monday, September 14, 2009 11:55 AM
>> Subject: [fw-i18n] Zend_Date / Zend_Format_Locale
>>
>>
>>>
>>> Hi,
>>>
>>> i would like to allow users to use the locale date format in a form text
>>> element.
>>>
>>> Since days i struggle wiht Zend_Date / Zend_Format_Locale but can't find
>>> a
>>> solution.
>>>
>>> $locale = new Zend_Locale('de_DE'); // and en_US, ....
>>> Zend_Registry::set('Zend_Locale', $locale);
>>>
>>> $this->addElement('text', 'date', array(
>>> 'validators' => array(
>>>         array('Date', false, array(Zend_Locale_Format::STANDARD,
>>> $locale)),
>>> ),
>>> 'label'      => 'date',
>>> ));
>>>
>>> Whatever locale is used the validator reqiured "MM.dd.yyyy" as date.
>>> What
>>> am
>>> i doing wrong?
>>>
>>> Thanks a lot for any hints.
>>>
>>> Regards
>>> Tom
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Zend_Date---Zend_Format_Locale-tp25433106p25433106.html
>>> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.
>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Zend_Date---Zend_Format_Locale-tp25433106p25433274.html
> Sent from the Zend I18N/Locale mailing list archive at Nabble.com.