用element-ui 时,报value.getTime is not a function错误:

在用element-ui 时,报value.getTime is not a function错误:
错误分析:
date-picker 的时间是格林威时间,如果Thu Jun 22 2017 19:07:30 GMT+0800,然后我们存入的数据库的时间为:2017-06-22 19:07:30的格式,所以在用2017-06-22 19:07:30去V-model date-picker就会报以上错误。
解决方案:
将2017-06-22 19:07:30 转换成Thu Jun 22 2017 19:07:30 GMT+0800即可!
附带格林威时间转换:vue中的转换
methods :{

GMTToStr : function(time){
    let date = new Date(time)
    let Str=date.getFullYear() + '-' +
            (date.getMonth() + 1) + '-' +
            date.getDate() + ' ' +
            date.getHours() + ':' +
            date.getMinutes() + ':' +
            date.getSeconds()
    return Str
},
StrToGMT(time){
    let GMT = new Date(time)
    return GMT
}

}

原文地址:https://www.cnblogs.com/wulihong/p/9361902.html