物件
你可以透過在物件中指定一些單位來建立一個 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});
day
和 date
鍵都表示這個月的某一天。
dayjs({})
會回傳目前時間。
請注意,就像 new Date(year, month, date)
一樣,月份是從 0 開始編號的。