微信开发工具列表使用sort排序,iOS端无法正常使用?

小程序 文章 2020-08-29 11:21 895 0 全屏看文

AI助手支持GPT4.0

微信开发工具列表使用sort排序,iOS端无法正常使用?The list of WeChat development tools is sorted by sort, but the iOS terminal cannot be used normally?

微信开发工具列表使用sort排序,iOS端无法正常使用?
            crash.crashList.sort((a,b)=>{              let aTime = new Date(a.time);              let bTime = new Date(b.time);              return bTime.getTime() - aTime.getTime();            })

s上面的排序代码,模拟器调试和Android iOS真机调试都正常,但是发布后使用iOS端打开排序就会乱掉,Android端又是正常的

下面是排序正常的

             crash.crashList.sort ((a,b)=>{              let aTime = new Date(a.time);              let bTime = new Date(b.time);              return  bTime.getTime () -  aTime.getTime (); The sorting code above, simulator debugging and Android IOS real machine debugging are all normal, but the sorting will be disordered after opening the IOS side after release. The Android side is normal again, and the following is normal

回答:

Distance:

IOS下日期的-要改成/再去获取时间戳,不然会是null

Admin²⁰²⁰:

a.time和b.time格式请用/替换-,-在iOS下不兼容

参考:

微信小程序中的日期格式在Android和iOS真机下兼容性问题的坑 | 微信开放社区

https://developers.weixin.qq.com/community/develop/article/doc/000e2e82d14cd80838c9cb8b552013

11月:

你试试看先把日期格式改为YY/MM 这样在new Date。

-EOF-

AI助手支持GPT4.0