微信支付的回调参数time_end
为日期字符串。
需求:将20190523101156
转化为转换为Date日期格式Thu May 23 2019 10:11:56 GMT+0800 (中国标准时间)
const str2date = (dateString)=> {const pattern = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/;return new Date(dateString.replace(pattern, '$1/$2/$3 $4:$5:$6'));
}
const date = str2date('20190523101156');
console.log(date);