import { HarperDBRecord } from '../types/interfaces' ; import { max , fromUnixTime , formatDistanceToNow } from 'date-fns' ; const getLastLogin = ( data ) => { if ( ! data ) { return new Date ( ) . valueOf ( ) ; } const timestamps = [ ] ; data ?. forEach ( ( site ) => { timestamps . push ( site . last_login ) ; } ) ; const latest = max ( timestamps ) ; return + latest ; } ; export default getLastLogin ;