对象
你可以通过指定对象中的某些单位来创建 Dayjs 对象。
¥You can create a Dayjs object by specifying some of the units in an object.
This requires the
ObjectSupport
plugin to work
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});
day
和 date
键均表示该月的日期。
¥day
and date
key both mean day of the month.
dayjs({})
返回当前时间。
¥dayjs({})
returns the current time.
请注意,与 new Date(year, month, date)
一样,月份的索引为 0。
¥Note that like new Date(year, month, date)
, months are 0 indexed.