Compare two dates
JavaScript version
// `a` and `b` are `Date` instances
const compare = (a, b) => a.getTime() > b.getTime();
TypeScript version
const compare = (a: Date, b: Date): boolean => a.getTime() > b.getTime();
Example
compare(new Date('2020-03-30'), new Date('2020-01-01')); // true