Android 与 ios获取时间戳的问题

 1 compareTime (timeStr) {
 2             const u = navigator.userAgent
 3             const isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1 // Android终端
 4             const isIOS = !!u.match(/(i[^;]+;( U;)? CPU.+Mac OS X/) // ios终端
 5             if (isAndroid) {
 6                 // Android 识别 2020-12-14 13:32:00
 7                 return new Date(`${this.clinicDate} ${timeStr}`).getTime() < new Date().getTime()
 8             } else if (isIOS) {
 9                 // ios 不识别 2020-12-14 13:32:00  , 识别 2020/12/14 13:32:00 
10                 return new Date(`${this.clinicDate} ${timeStr}`.replace(/-/g, '/')).getTime() < new Date().getTime()
11             } else {
12                 return new Date(`${this.clinicDate} ${timeStr}`).getTime() < new Date().getTime()
13             }
14         },
原文地址:https://www.cnblogs.com/-roc/p/14183592.html