CustomParseFormat
CustomParseFormat estende il costruttore dayjs()
per supportare formati personalizzati delle stringhe in ingresso.
javascript
var customParseFormat = require('dayjs/plugin/customParseFormat');
// import customParseFormat from 'dayjs/plugin/customParseFormat' // ES 2015
dayjs.extend(customParseFormat);
dayjs('05/02/69 1:02:03 PM -05:00', 'MM/DD/YY H:mm:ss A Z');
// Restituisce un oggetto che rappresenta '1969-05-02T18:02:03.000Z'
dayjs('2018 Enero 15', 'YYYY MMMM DD', 'es');
// Restituisce un oggetto che rappresenta '2018-01-15T00:00:00.000Z'
dayjs('1970-00-00', 'YYYY-MM-DD', true); // Analisi rigorosa