[FLOW3-general] DateTime format in my view
Sergio
naguib.mahfuz at gmail.com
Thu Jan 3 10:26:17 CET 2013
Not working :-(
I was trying to change date format before the form is displayed in the edit
view, calling in an initializeEditAction() something like this:
$this->arguments['workingDay']->getPropertyMappingConfiguration()->forProperty('break')->setTypeConverterOption('TYPO3\Flow\Property\TypeConverter\DateTimeConverter',
\TYPO3\Flow\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT,
'H:i');
But that's not working neither.
2013/1/3 David Sporer <david.sporer at gmail.com>
> Try this:
> <f:form.textfield property="break.date" id="break" value="{break.date ->
> f:format.date(format:'d.m.Y H:i')}" />
>
>
> -----Ursprüngliche Nachricht-----
> Von: flow3-general-bounces at lists.typo3.org
> [mailto:flow3-general-bounces at lists.typo3.org] Im Auftrag von Sergio
> Gesendet: Donnerstag, 3. Januar 2013 10:00
> An: General discussion about FLOW3
> Betreff: Re: [FLOW3-general] DateTime format in my view
>
> Yes, but I don't need a formatted text, I need to show an "input" element
> for a form, something like this:
>
> <f:form.textfield property="break.date" id="break" />
>
> I assumed I couldn't do the next (I receive a syntax error):
>
> <f:form.textfield property="break.date" id="break" value="<f:format.date
> format="d.m.Y - H:i:s">{break.date}</f:
> format.date>
> " />
>
> Is there a way to mix these two things?
>
> Thanks in advance,
> Sergio
>
>
>
> 2013/1/2 David Sporer <david.sporer at gmail.com>
>
> > Hi Sergio,
> >
> > yes, this means you need to use the View Helper John mentioned.
> > E.g. use this in your template:
> > <f:format.date format="d.m.Y - H:i:s">{pass.createdon}</f:format.date>
> >
> > Best regards
> > David
> >
> >
> > -----Ursprüngliche Nachricht-----
> > Von: flow3-general-bounces at lists.typo3.org
> > [mailto:flow3-general-bounces at lists.typo3.org] Im Auftrag von Sergio
> > Gesendet: Mittwoch, 2. Januar 2013 18:26
> > An: General discussion about FLOW3
> > Betreff: Re: [FLOW3-general] DateTime format in my view
> >
> > Hi John,
> >
> > I think you misunderstood me: I know you can change that format every
> > time you create an object containing a DateTime property. But I don't
> > mean when CREATING or UPDATING the object, but showing the form to
> > edit before updating. I don't know why the format of the date, despite
> > it is saved as "H:i" in the database, when showing, it is shown again
> > in the default format for my form input. If I var_dump() my object,
> > the property shows like this
> > again:
> >
> > *protected* 'date' =>
> > *object*(*DateTime*)[*1933*]
> > *public* 'date' => string '2013-01-02 18:18:51' *(length=19)*
> > *public* 'timezone_type' => int 3
> > *public* 'timezone' => string 'Europe/Berlin' *(length=13)
> >
> > *
> >
> > I would like the 'date' would show only "18:18".
> >
> > Sergio
> >
> >
> > 2012/12/28 John Small <flow3.tiny69 at net-con.net>
> >
> > > Hi,
> > >
> > > theres a Viewhelper for that:
> > >
> > > {some.date -> f:format.date(format:'d.m.Y H:i')}
> > >
> > > but then you need to have a proper method in the controller who is
> > > able to handle that format of the date to pass it to the model,
> > > because the model expects "2012-12-28 12:33:00"
> > >
> > > like this
> > >
> > > public function initializeCreateAction() {
> > >
> > > $this->addFlashMessage('here: initializeCreateAction');
> > > // set Format for property begin
> > > $this->arguments['newEvent']
> > > ->**getPropertyMappingConfiguratio**n()
> > > ->forProperty('begin')
> > > ->setTypeConverterOption('**TYPO3\FLOW3\Property\**TypeConverter\**D
> > > ->at
> > > ->eTimeConverter',
> > >
> > > \TYPO3\FLOW3\Property\**TypeConverter\**DateTimeConverter::**CONFIGU
> > > RA
> > > TION_DATE_FORMAT,
> > >
> > > '!d.m.Y H:i');
> > > }
> > >
> > >
> > > same for an update method
> > >
> > > HTH
> > >
> > >
> > >
> > > Am 28.12.2012 15:06, schrieb Sergio:
> > >
> > > Hi list,
> > >>
> > >> I have this in my edit view:
> > >>
> > >> ...
> > >> <f:form.textfield property="break.date" id="break" /> ...
> > >>
> > >> where "break" is a \DateTime property. Despite I define the break
> > >> attribute in my model like this:
> > >>
> > >> /**
> > >> * The break time
> > >> * @var \DateTime
> > >> * @Flow\Validate(type="NotEmpty"**)
> > >> * @ORM\Column(type="time")
> > >> */
> > >> protected $break;
> > >>
> > >> and it is saved in format "12:33" in my database (because I asked
> > >> for it when creating through Property Mapping Configuration), when
> > >> the object is edited, it is shown again in format "2012-12-28
> 12:33:00".
> > >>
> > >> Why does this happen? And would you know a way to alter this
> > >> break.date format and showin "12:33" format to the user in the view?
> > >>
> > >> Thanks in advance,
> > >> Sergio
> > >>
> > >>
> > >
> > > --
> > > kind regards
> > >
> > >
> > > ______________________________**_________________
> > > FLOW3-general mailing list
> > > FLOW3-general at lists.typo3.org
> > > http://lists.typo3.org/cgi-**bin/mailman/listinfo/flow3-**general<ht
> > > tp ://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general>
> > >
> > _______________________________________________
> > FLOW3-general mailing list
> > FLOW3-general at lists.typo3.org
> > http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
> >
> > _______________________________________________
> > FLOW3-general mailing list
> > FLOW3-general at lists.typo3.org
> > http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
> >
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
>
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
>
More information about the FLOW3-general
mailing list