Typescript Find Max Date In Array Javascript Length Function