Day.js 中文文档

当前版本 v1.11

更多文档

对象

你可以通过指定对象中的某些单位来创建 Dayjs 对象。

需要配合 ObjectSupport 插件才能工作

dayjs.extend(objectSupport)
dayjs({ hour:15, minute:10 });
dayjs.utc({ y:2010, M:3, d:5, h:15, m:10, s:3, ms: 123});
dayjs({ year :2010, month :3, day :5, hour :15, minute :10, second :3, millisecond :123});
dayjs({ years:2010, months:3, date:5, hours:15, minutes:10, seconds:3, milliseconds:123});

daydate 键均表示该月的日期。

dayjs({}) 返回当前时间。

请注意,与 new Date(year, month, date) 一样,月份的索引为 0。

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