Module

collaboration-core/utils/getdatetimeformatter

@ckeditor/ckeditor5-collaboration-core/src/utils/getdatetimeformatter

module

Filtering

Functions

  • getDateTimeFormatter( localeConfig ) → ( Date | string ) => string

    Returns a function that formats the date to the set 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

    localeConfig : LocaleConfig

    Defaults to {}

    Returns

    ( Date | string ) => string