[TYPO3-mvc] Bug #5583: DateFormat View Helper doesn't respect locale setting

Thomas Maroschik tmaroschik at dfau.de
Tue Dec 1 16:20:55 CET 2009


Good afternoon dear newsgroup.

In consequence to Jochen's request I'm posting here now my solution for 
the mentioned Bug #5583(http://forge.typo3.org/issues/show/5583)

So, if you're using PHP 5.3 or an own DateTime class like described in 
#5595(http://forge.typo3.org/issues/show/5595) you can get localized 
dates by typoscript.

Just create a typoscript TEXT object and use the f:cObject view helper 
to format the date with strftime.

This could look like this in Fluid when using PHP 5.3 or your own 
DateTime Class:

<f:CObject typoscriptObjectPath="xyz.date">{date.timestamp}</f:CObject>

... and in Typoscript:

xyz.date = TEXT
xyz.date {
	current = 1
	strftime = %d. %B %Y
}

That way you can handle your dates in your extension globally, so you 
don't need to change countless f:format.date tags.

If you don't use PHP 5.3 or an own DateTime class you can workaround it 
this way in Fluid:

<f:CObject typoscriptObjectPath="xyz.date"><f:format.date 
format="U">{date}</f:format.date></f:CObject>

Best regards and thank you very much for your great work on extbase and 
fluid :)


Thomas Maroschik


More information about the TYPO3-project-typo3v4mvc mailing list