【问题标题】:jQuery datepicker integration with TYPO3 FlowjQuery datepicker 与 TYPO3 Flow 的集成
【发布时间】:2023-03-12 13:41:01
【问题描述】:

知道如何让 jQuery datepicker 在 TYPO3 Flow 中工作吗?

我在流体视图中集成了选择器,并将 mysql-row 定义为 \DateTime。

$('.datepicker').datepicker({
    dateFormat: 'd.m.yy'
});

型号:

/**
 * @var \DateTime
 * @Flow\Validate(type="NotEmpty")
 */
protected $tourStart;

在控制器中我必须转换字符串:

/**
 * 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'
        );
}

这似乎不起作用。

错误: tourStart 无法识别日期“14.11.2014”(格式为“Y-m-d\TH:i:sP”)。 tourStart 是必需的

你知道出了什么问题吗?

【问题讨论】:

    标签: jquery datepicker typo3 typo3-flow


    【解决方案1】:

    我认为您缺少 forProperty()。下面是它在 initializeCreateAction 中的样子:

    $this->arguments['tour']
    ->getPropertyMappingConfiguration()
    ->forProperty('tourStart')
    ->setTypeConverterOption('TYPO3\Flow\Property\TypeConverter\DateTimeConverter', \TYPO3\Flow\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT, 'd.m.Y');
    

    我假设 'tour' 是 createAction 的参数名称,而 'tourStart' 是属性。

    【讨论】:

    • 你是对的.. 我不得不拆分转换并分开 'tourStart' 和 'tourEnd'.. 但我无法弄清楚原因.. 无论如何现在它可以工作了..
    猜你喜欢
    • 2014-10-30
    • 1970-01-01
    • 2012-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多