Array
Puoi creare un oggetto Dayjs utilizzando un array di numeri che corrispondono ai parametri passati a new Date()
.
TIP
Per utilizzare questa funzionalità, è necessario il plugin ArraySupport.
js
dayjs.extend(arraySupport);
dayjs([2010, 1, 14, 15, 25, 50, 125]); // 14 febbraio, 15:25:50.125
dayjs.utc([2010, 1, 14, 15, 25, 50, 125]);
dayjs([2010]); // 1 gennaio
dayjs([2010, 6]); // 1 luglio
dayjs([2010, 6, 10]); // 10 luglio
dayjs([])
restituisce la data e l'ora correnti.
Nota che, come in new Date(year, month, date)
, i mesi sono indicizzati a partire da 0.