Im having issues with a jquery script (below) which should change the format of the date within a date picker, input field (named 'jform[moving_date]').
var months = ['Jan','Feb','May','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var element = $('input[name=jform[moving_date]]');
element.on('change', function(e) {
// You might need to stop propagation but this will cause other scripts from firing like date picker.
// e.stopPropagation();
var date_parts = $(this).val().split('-');
var month_index = Number(date_parts[1]) - 1;
var date_new = date_parts[0] + '-' + months[month_index] + '-' + date_parts[2];
$(this).val(date_new);
});
The current date format is: 31-12-2016
I need it in the following format: 31-Dec-2016
Many thanks in advance!