教程 dayjs tutorial

ToObject

ToObject 增加了 .toObject() API 来返回包含时间数值的 object。

javascript
var toObject = require("dayjs/plugin/toObject");
dayjs.extend(toObject);

dayjs("2019-01-25").toObject();
/* { years: 2019,
     months: 0,
     date: 25,
     hours: 0,
     minutes: 0,
     seconds: 0,
     milliseconds: 0 } */