Skip to content

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?

Answer

Looks like there is no way to do it out-of-the-box. The only way is tweaking dates format (e.g., with momentjs) before submitting data.