[uniapp/WeChat applet] The countdown function is abnormal in ios, but there is no problem in local debugging

insert image description here
I used setTimeInterval to make a countdown function. It was fine when I tested it with developer tools, but I couldn’t count down normally when I debugged it with the ios real machine. Later, I found out that the problem lies inDate.parse

Date.parse(endTime)

If the incoming endTime is 2022-01-12 12:21:09in the format, ios cannot parse it normally. If you replace -it with /, all operating systems can display it normally.

Date.parse(endTime.replace(/-/g, "/"))

Guess you like

Origin blog.csdn.net/SingDanceRapBall/article/details/130804584