[英]Tempus dominus: decoupling the rendered date format from the actual value sent upon form submission
I'm using Tempus Dominus bootstrap-4 version 5.39.0.我正在使用Tempus Dominus bootstrap-4版本 5.39.0。 I can configure the displayed time format in this way:
我可以通过这种方式配置显示的时间格式:
$('.datePicker').datetimepicker({
format: 'DD/MM/YYYY',
locale: 'en'
})
But this sends to server dates in the format: 'DD/MM/YYYY'
while it consumes dates in format 'YYYY-MM-DD'
.但这会以格式发送到服务器日期:
'DD/MM/YYYY'
而它使用格式'YYYY-MM-DD'
日期。 Is there a way to decouple the value displayed in the form from the one sent to server upon submission?有没有办法将表单中显示的值与提交时发送到服务器的值分离?
Looks like there is no way to do it out-of-the-box.看起来没有办法做到开箱即用。 The only way is tweaking dates format (eg, with
momentjs
) before submitting data.唯一的方法是在提交数据之前调整日期格式(例如,使用
momentjs
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.