数组
你可以使用反映传递给 new Date()
的参数的数字数组创建 Dayjs 对象
¥You can create a Dayjs object with an array of numbers that mirror the parameters passed to new Date()
This requires the
ArraySupport
plugin to work
dayjs.extend(arraySupport)
dayjs([2010, 1, 14, 15, 25, 50, 125]); // February 14th, 3:25:50.125 PM
dayjs.utc([2010, 1, 14, 15, 25, 50, 125]);
dayjs([2010]); // January 1st
dayjs([2010, 6]); // July 1st
dayjs([2010, 6, 10]); // July 10th
dayjs([])
返回当前时间。
¥dayjs([])
returns the current time.
请注意,与 new Date(year, month, date)
一样,月份的索引为 0。
¥Note that like new Date(year, month, date)
, months are 0 indexed.