Optionalsource: string | Date | nullThe first date to compare
Optionaltarget: string | Date | nullThe second date to compare
Whether a nil (undefined or null) value is considered greater than another non-nil value
1 if source greater than target, -1 if source less than target, 0 if equals
compareDate(new Date('2023-01-02'), new Date('2023-01-01')); // 1
compareDate(new Date('2023-01-01'), new Date('2023-01-02')); // -1
compareDate(new Date('2023-01-01'), '2023-01-01'); // 0
compareDate(undefined, null); // 0
compareDate(undefined, new Date(), true); // 1
compareDate(undefined, new Date(), false); // -1
Returns 1 if source greater than target, -1 if source less than target, 0 if equals