import { Message } from '@internal/react-components' ; private export const compareMessages = ( firstMessage , secondMessage ) : number => { if ( firstMessage . createdOn === undefined ) { return 1 ; } if ( secondMessage . createdOn === undefined ) { return - 1 ; } const firstDate = new Date ( firstMessage . createdOn ) . getTime ( ) ; const secondDate = new Date ( secondMessage . createdOn ) . getTime ( ) ; const idDelta = firstMessage . messageId && secondMessage . messageId ? Number . parseInt ( firstMessage . messageId ) - Number . parseInt ( secondMessage . messageId ) : 0 ; return firstDate - secondDate === 0 ? idDelta : firstDate - secondDate ; } ;