报错 Aray size is not a small enough positive integer 的解决方案

在小程序使用dayjs的时候,遇到报错:

Aray size is not a small enough positive integer

由于部分手机兼容性问题,在使用dayjs构建日期数据对象时,使用new Date() 会引发意想不到的异常,所以如下代码:

dayjs(new Date(‘2021-10-15 15:00’)).hour()

会因为兼容性问题不能正常输出,(苹果手机输出NaN)

改进:

直接使用dayjs构建日期数据对象:

dayjs(‘2021-10-15 15:00’).hour()
原文地址:https://www.cnblogs.com/art-poet/p/15411177.html