时间转换toLocaleDateString()有坑
toLocaleDateString()
thisTime = new Date(thisTime).toLocaleDateString().replace(/\//g, '-');
百度小程序里这样写,在华为手机不兼容,点击没反应,但在苹果手机里会兼容,于是就百度了下面这种写法就都可以

解决办法:不要用它,太坑了!
如果想获取yyyyMMdd格式的字符串:
var str= new Date(); var str2= str.getFullYear() + "-" + (str.getMonth() + 1) + "-" + str.getDate();
getMonth()之所以要+1,是因为 JS 中getMonth()方法获取的值为0 ~ 11,分别对应我们的 1 月至 12 月,因此要想转换为我们熟悉的1 ~ 12

浙公网安备 33010602011771号