Day.js 中文文档

当前版本 v1.11

更多文档

ToObject

ToObject 添加 .toObject() API 以返回带有日期属性的 object

var toObject = require("dayjs/plugin/toObject");
// import toObject from 'dayjs/plugin/toObject' // ES 2015

dayjs.extend(toObject);

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

Day.js 中文文档 - 粤ICP备14034220号-1