stringToDate : function(dateStr,separator){
if(!separator){
separator="-";
}
var dateArr = dateStr.split(separator);
var year = parseInt(dateArr[0]);
var month;
//处理月份为04这样的情况
if(dateArr[1].indexOf("0") == 0){
month = parseInt(dateArr[1].substring(1));
}else{
month = parseInt(dateArr[1]);
}
var day = parseInt(dateArr[2]);
var date = new Date(year,month -1,day);
return date;
}作者: felt 时间: 2019-6-11 09:02:06