Translations
Info
All page names need to be in English.
en da  de  fr  it  ja  km  nl  ru  zh

Exception/Flow/1307719788

From TYPO3Wiki
Jump to: navigation, search
This page belongs to the Flow Team (category Flow)

notice - Note

Login and contribute! If you encountered this exception, please help others
by providing information about how you got
this error. Especially if you have a solution,
please add it to this page!
Package: Flow
Subpackage: Property
Versions:
Class: F3\FLOW3\Property\TypeConverter\DateTimeConverter
Method: convertFrom() {
Author: Bastian Waidelich <bastian@typo3.org>
Message: The string "..." could not be converted to DateTime with format "..."
Description: A string could not be converted to a \DateTime object. The default format for converting strings to dates is the W3C format (Y-m-d\TH:i:sP) , e.g. "2011-06-24T19:04:23+02:00"
Possible solutions:  If this happens in the MVC stack context and the string to be converted is coming from a fluid template, you can pass an additional hidden field "dateFormat" with the dateformat to be used for the conversion like this:
 <input type="text" name="event[date][date]" id="date" value="{event.date -> f:format.date(format:'d.m.Y')}"/>
 <f:form.hidden name="event[date][dateFormat]" value="d.m.Y" />

instead of

 <f:form.textbox id="date" property="date />

Another possibility is to set the format in an initialize*Action from your controller, e.g.:

 public function initializeUpdateAction() {
  $this->arguments->getArgument('event')
   ->getPropertyMappingConfiguration()->forProperty('date')
   ->setTypeConverterOption('F3\FLOW3\Property\TypeConverter\DateTimeConverter', \F3\FLOW3\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT, 'd.m.Y');
 }

User contributed notes:
Your comment could have

  • Screenshot
  • Link to another Exception or a wiki-page
  • link to a bugtracker-entry, to the API/ PHP-code

notes