Any idea how to get the jQuery datepicker working in TYPO3 Flow?
I integrated the picker in the fluid-view and defined the mysql-row as \DateTime.
$('.datepicker').datepicker({
dateFormat: 'd.m.yy'
});
the model:
/**
* @var \DateTime
* @Flow\Validate(type="NotEmpty")
*/
protected $tourStart;
In the controller I have to convert the string:
/**
* Initialize
* @return void
*/
public function initializeCreateAction() {
$tourStartMappingConf = $this->arguments->getArgument('tour')->getPropertyMappingConfiguration();
$tourStartMappingConf->allowProperties('tourStart', 'tourEnd');
$tourStartMappingConf->setTypeConverterOption(
'TYPO3\Flow\Property\TypeConverter\DateTimeConverter',
\TYPO3\Flow\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT,
'd.m.Y'
);
}
That doesn't seem to work.
Error: tourStart The date "14.11.2014" was not recognized (for format "Y-m-d\TH:i:sP"). tourStart is required
Do you have any idea what is wrong?
I think you are missing the forProperty(). Here is how it could look in initializeCreateAction:
$this->arguments['tour']
->getPropertyMappingConfiguration()
->forProperty('tourStart')
->setTypeConverterOption('TYPO3\Flow\Property\TypeConverter\DateTimeConverter', \TYPO3\Flow\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT, 'd.m.Y');
I assume 'tour' is the param name for the createAction and 'tourStart' is the property.