我在我的 symfony2 表单中添加了一个 jQuery datepicker。
树枝文件:
$('.date').datepicker({ 
    showOn: 'button', 
    buttonImageOnly: true, 
    changeMonth: true,
    changeYear: true,
    dateFormat: 'yy-MM-dd ',
    yearRange: "-0:+1"  
});
PostType.php
$builder->add('toDate','datetime',array(
                'input' => 'datetime',
                'widget' => 'single_text',
                'format' => 'yy-MM-dd',
                'attr' => array('class' => 'date')
        ));
我尝试了几种日期格式。但我总是This value is not valid.在提交时得到。我试图获取表单错误,但它没有提供更多信息。