easyui中datagrid里的datebox修改时会默认变为当前日期,怎么解决

正常的时间为2019-01-13
图片说明
双击修改后会默认变为当前时间
图片说明

时间列声明方式:

<th field="birthday" sortable='true' editor="{type:'datebox',options:{editable:false}}" formatter="formatDatebox">出生日期</th>

时间格式化方法:

Date.prototype.format = function (format) {
    var o = {
        "M+": this.getMonth() + 1, // month
        "d+": this.getDate(), // day
        "h+": this.getHours(), // hour
        "m+": this.getMinutes(), // minute
        "s+": this.getSeconds(), // second
        "q+": Math.floor((this.getMonth() + 3) / 3), // quarter
        "S": this.getMilliseconds()
        // millisecond
    }
    if (/(y+)/.test(format))
        format = format.replace(RegExp.$1, (this.getFullYear() + "")
            .substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(format))
            format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
    return format;
}
function formatDatebox(value) {
    if (value == null || value == '') {
        return '';
    }
    var dt;
    if (value instanceof Date) {
        dt = value;
    } else {
        dt = new Date(value);
    }

    return dt.format("yyyy-MM-dd"); //扩展的Date的format方法(上述插件实现)
}

楼主自己解决的,其实是因为从后台JSON传入的时间格式不对。本来的时间格式为:Apr ... 13/01/1018 (就是最原始的格式)。
然后我还了Jackson中的@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")的注解,转换了时间格式。这样
在转换JSON过程中,就自动转换成 2018-01-13 12:33:21这种格式,此时edatagrid中的databox的日历控件就不会出现这种情况了。

datebox使用起来,很简单呀。先:input id="createdDate" class="textbox" style="width:130px;"/>,然后页面初始化时使用
$("#createdDate,#endDate).datebox();就可以了,没有你写的那么复杂,如果你需要默认某一天或者从当前时间前推或后推多少天,可以参考easyui的api,很详细了http://www.jeasyui.com/documentation/