A function that formats date to the custom format.
The default formatting can be changed by setting a custom formatting function to config.locale.dateTimeFormat
.
import format from 'date-fns/format';
ClassicEditor
.create( document.querySelector( '#editor' ), {
toolbar: {
items: [ 'bold', 'italic', '|', 'comment' ]
},
sidebar: {
container: document.querySelector( '#sidebar' )
},
locale: {
dateTimeFormat: date => format( date, 'dd/MM/yyyy' )
}
} )
.catch( error => console.error( error ) );
Parameters
date
:
Date
-
Returns
String
The generated date.