Suppose you want to show the user a date this way:
2017-03-22 22:53
But you want the form to send 2017-03-22T22:53:00-03:00
to the server.
How can I do this?
You have to set the field's value at submit event.
var options = {
'sideBySide': true,
'showTodayButton': true,
'useCurrent': true,
'extraFormats': [moment.ISO_8601]
};
var $dpStart = $('#start-date');
var $dpEnd = $('#end-date');
$dpStart.datetimepicker(options);
$dpEnd.datetimepicker(options);
$('#the-form').on('submit', function(event){
$dpStart.val($dpStart.data("DateTimePicker").date().format());
$dpEnd.val($dpEnd.data("DateTimePicker").date().format());
});