import moment from 'moment' ; export const labelDateFormatter = ( label , dateformat = 'lll' ) => { let formattedLabel = label ; const isDate = moment ( label , '' , true ) . isValid ( ) ; if ( isDate ) { formattedLabel = moment ( label ) . format ( dateformat ) ; } return formattedLabel ; } ;