When dealing with the HTML input of datetime type, consider the following:
Datefield:
<input type="datetime-local" data-date="" data-date-format="DD MMMM YYYY, h:mm:ss">
The script below includes important code.
$("input").val(moment().format('YYYY-MM-DD, h:mm:ss'));
$("input").on("change", function() {
this.setAttribute(
"data-date",
moment(this.value)
.format( this.getAttribute("data-date-format") )
)
}).trigger("change")
I came across http://jsfiddle.net/g7mvaosL/
which allows changing the date pattern.
However, when attempting to do the same with type="datetime-local", it did not work. How can this issue be resolved?