CustomParseFormat
CustomParseFormat étend la fonction dayjs()
pour permettre l'analyse de chaînes de date et d'heure avec des formats personnalisés.
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');
// Renvoie une instance Dayjs correspondant à '1969-05-02T18:02:03.000Z'
dayjs('2018 Janvier 15', 'YYYY MMMM DD', 'fr');
// Renvoie une instance Dayjs correspondant à '2018-01-15T00:00:00.000Z'
dayjs('1970-00-00', 'YYYY-MM-DD', true); // Analyse stricte