简体   繁体   中英

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. 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' . 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM