I have a function that formats a cell from a MySQL db in a datagrid dd/mm/yyyy
function formatDate1(val,row){
return formattedDate(val);
}
function formattedDate(date) {
var d = new Date(date || Date.now()),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();
if (month.length < 2) month = '0' + month;
if (day.length < 2) day = '0' + day;
return [day, month, year].join('/');
}
The edit form displays the date in a text box, as per the crud example. I thought I could use the same function as follows:
<input name="date" class="easyui-textbox" data-options="formatter:formatDate1">
but it has no effect.
Ideally I would like to use a datebox. What do I need to change to display a date dd/mm/yyyy so that when the form is saved the date is yyyy/mm/dd .
Thanks.