教程 dayjs tutorial

当前时间

直接调用 dayjs() 将返回一个包含当前日期和时间的 Day.js 对象。

javascript
var now = dayjs();

等同于 dayjs(new Date()) 的调用。

当没有传入参数时,参数默认值是 undefined,所以调用 dayjs(undefined) 就相当于调用 dayjs()。

Day.js 将 dayjs(null) 视为无效的输入。