前端 苹果手机里手机时间格式转化问题(Mobile phone time format conversion in front-end Apple mobile phone)

问题的出现

let   date1  = 11111111111111111
let   date2  = 22222222222222222

let   falg =  (new Date(date1).getTime()>new Date(date2).getTime())
                 //苹果手机这里是转化不出来的,都是NAN

 if(falg){

       console.log("逻辑处理")
}

问题的解决 要把时间格式里面的-替换为/

 let regTime = result.RegTime.replace(/\-/g, “/”);

————————

Emergence of problems

let   date1  = 11111111111111111
let   date2  = 22222222222222222

let   falg =  (new Date(date1).getTime()>new Date(date2).getTime())
                 //苹果手机这里是转化不出来的,都是NAN

 if(falg){

       console.log("逻辑处理")
}

To solve the problem, replace the – in the time format with/

 let regTime = result.RegTime.replace(/\-/g, “/”);