Array
new Date()
に渡すパラメータと同様の数値配列を使用して、Dayjs オブジェクトを作成できます。
TIP
これを使用するには、ArraySupport プラグインが必要です。
js
dayjs.extend(arraySupport);
dayjs([2010, 1, 14, 15, 25, 50, 125]); // 2010年2月14日、午後3時25分50秒125ミリ秒
dayjs.utc([2010, 1, 14, 15, 25, 50, 125]);
dayjs([2010]); // 2010年1月1日
dayjs([2010, 6]); // 2010年7月1日
dayjs([2010, 6, 10]); // 2010年7月10日
dayjs([])
は現在時刻を返します。
new Date(year, month, date)
と同様に、月は 0 から始まるインデックスであることに注意してください。