Selected date will be sent to the server in the specific format.
Actual result
When using format (not dateFormat), I get a JS error. When using dateFormat, the format is ignored and I get the default JavaScript date format on the backend.
Environment
LAMP, Ubuntu 20.4, PHP 7.4, MySQL 8
jQuery version: latest
Browser: Chrome
OS: macOS
The code I use not to fix the problem (jquery.jeditable.datepicker.js):
submit: function (settings, original) {
var dateRaw = $('input', this).datepicker('getDate');
var dateFormatted;
dateFormatted = dateRaw;
if (settings.datepicker.format) {
// Code below NOT working
// dateFormatted = $.datepicker.formatDate(settings.datepicker.format, new Date(dateRaw));
// Lazy hack to get my date format.
let _date = new Date(dateRaw);
dateFormatted = _date.getFullYear() + '/' + (_date.getMonth() + 1) + '/' + _date.getDate();
}
$('input', this).val(dateFormatted);
},
Description
It is not possible to use the date formatting features of the jEditable datepicker plugin type-of element.
How to reproduce
Create a datepicker setting into an editable type. See the date type received on the server side. I tried all combos (format, dateFormat, both)
It helps a lot if you can create a working example from this template: https://codepen.io/iedutu/pen/bGrNKJV
Expected result
Selected date will be sent to the server in the specific format.
Actual result
When using format (not dateFormat), I get a JS error. When using dateFormat, the format is ignored and I get the default JavaScript date format on the backend.
Environment
LAMP, Ubuntu 20.4, PHP 7.4, MySQL 8
jQuery version: latest Browser: Chrome OS: macOS
The code I use not to fix the problem (jquery.jeditable.datepicker.js):