小程序 new Date(2019-03-01 00:00:00) 返回对象null

时间:2019-03-18 13:50:17   收藏:0   阅读:187

IOS只识别 2019-03-01 这样的日期格式, 不支持 2019-03-01 00:00:00

用正则替换2019-03-01日期格式为2019/03/01后问题解决

  let newDate = (date).replace(/-/g, ‘/‘);
  return new Date(newDate);

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!