import moment from 'moment' export const dateDisplayFormat = ( value: string, time = false, customFormat?: string, format?: string[] ) => { let momentObj: any if (format?.length) { momentObj = moment(value, format) } else { momentObj = moment(value, ['YYYY-MM-DDTHH:mm:ss.000Z']) } if (customFormat) { return momentObj.format(customFormat) } else { return momentObj.format(`DD-MM-YYYY ${time ? 'HH:mm:ss' : ''}`) } }