It works well in the X5 JSCore and node environment, but it doesn't work in the iOS WKWebView environment.Why?
Here is my code:
var test = [
{name: "aaa",createTime: "2019-10-10T11:11:16.000+0000"},
{name: "ccc",createTime: "2019-10-03T10:11:16.000+0000"},
{name: "bbb",createTime: "2019-10-07T10:11:16.000+0000"},
{name: "zzz",createTime: "2019-10-09T03:12:25.000+0000"},
]
const sortList = test.sort((a, b) => {
return new Date(b.createTime) - new Date(a.createTime)
})
console.log(sortList);
I use this article as a reference, but it doesn't work in other contexts How to sort strings in JavaScript
If the ISO string were illegal, it would not work in any environment, but now it works in other environments.
Only iOS environment doesn't work.
why?
Can you help me?