英文:
How to accept German date format in Contao 4 widget?
问题
我正在使用 Contao 4,并且有一个小部件,其配置如下所示:
'eval' => array(
'class' => 'valid_date',
'rgxp' => 'date',
'dateformat' => 'd.m.Y',
'datepicker' => TRUE,
'tl_class' => 'w50 wizard',
'maxlength' => 255,
'mandatory' => TRUE
),
默认的 'date' 验证期望日期格式为 YYYY-MM-DD,但我需要接受德国的日期格式(d.m.Y)。
我尝试过以下:
'dateformat' => 'd.m.Y',
'datepickerFormat' => 'd.m.Y',
是否有内置解决方案或替代方法来处理德国的日期格式,而不必创建自定义过滤器模块?
当前区域设置可能有问题吗?Contao 会检测当前区域设置吗?
但前端显示的是德文,甚至错误消息也是德文。
英文:
I'm working with Contao 4 and have a widget with the following configuration in the eval sub array:
'eval' => array(
'class' => 'valid_date',
'rgxp' => 'date',
'dateformat' => 'd.m.Y',
'datepicker' => TRUE,
'tl_class' => 'w50 wizard',
'maxlength' => 255,
'mandatory' => TRUE
),
The default 'date' validation expects the format to be in YYYY-MM-DD, but I need to accept the German date format (d.m.Y).
I have tried the following:
'dateformat' => 'd.m.Y',
'datepickerFormat' => 'd.m.Y',
Is there a built-in solution or an alternative approach to handle the German date format without creating a custom filter module?
Is maybe something wrong with the current locale? Would Contao detect the current locale?
But the frontend is displayed in German and even the error message is in German.
答案1
得分: 0
我看错地方了。
日期格式在“系统 -> 设置”中配置。如果我更改它,它就能正常工作。
英文:
I was looking at the wrong place.
The date format is configured at System -> Settings. If I change that, it works.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论