[TYPO3-mvc] DateTime in Fluid

Franz Koch typo3.RemoveForMessage at elements-net.de
Fri May 20 02:06:27 CEST 2011


Hey,

> <f:form.textbox property="datetime"
> value="{f:format.date(format:'{settings.dateFormat}', date:
> '{myObj.datetime}')}" />
>
>
> If I remove the part
> value="{f:format.date(format:'{settings.dateFormat}', date:
> '{myObj.datetime}')}" then the code becomes
>
> <f:form.textbox property="datetime" />
>
> In this case I don't see anything in the textbox. So my question was why
> Fluid does not show the date in the textbox and why I have to force the
> value attribute?

Which dateFormat would you expect to get if FLUID would render the 
DateTime object as input field value? A timestamp? YYYY-MM-DD? The date 
format configured in TYPO3 InstallTool? Or better have it configurable?
Last thing is how it's done currently. Of course the textbox VH could do 
a auto-conversion, but that would need that we would have to add a 
additional "format" attribute that only applies for dates? Doesn't make 
much sense to me as we would end up integrating more and more edge case 
settings for things that already are available in concrete VHs.
Thus the only *good* solution for what you want is to create a (HTML5 
compatible) f:form.date viewHelper. But it's definitely nothing a common 
textbox VH should deal with.

But if you have other suggestions on how that should work, let us know 
and we'll see.

> So using "value" is the way or is there any other *nice* way?

As long as there is no *good* suggestion for a default behavior how 
DateTime objects should magically be converted to correctly formatted 
strings without passing any configuration option like a format, this is 
the way ;)

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list