Determine if Two Events Have Conflict

2446. Determine if Two Events Have Conflict

Given an alphanumeric string s, return the second largest numerical digit that appears in s, or -1 if it does not exist.

An alphanumeric string is a string consisting of lowercase English letters and digits.

### Example 1:
Input: event1 = ["01:15","02:00"], event2 = ["02:00","03:00"]
Output: true
Explanation: The two events intersect at time 2:00.
### Example 2:
Input: event1 = ["01:00","02:00"], event2 = ["01:20","03:00"]
Output: true
Explanation: The two events intersect starting from 01:20 to 02:00.
Constraints:
evnet1.length == event2.length == 2.
event1[i].length == event2[i].length == 5
startTime1 <= endTime1
startTime2 <= endTime2
All the event times follow the HH:MM format.
/**
 * @param {string[]} event1
 * @param {string[]} event2
 * @return {boolean}
 */
 var haveConflict = function(event1, event2) {

    const dateObj = new Date();
    const year = dateObj.getFullYear();
    const month = dateObj.getMonth();
    const day = dateObj.getDate();
 
    const event1Start = event1[0].split(':');
    const event1End = event1[1].split(':');
 
    const event2Start = event2[0].split(':');
    const event2End = event2[1].split(':');
 
    const event1StartDate = new Date(year, month, day, event1Start[0], event1Start[1]);
    const event1EndDate = new Date(year, month, day, event1End[0], event1End[1]);
 
    const event2StartDate = new Date(year, month, day, event2Start[0], event2Start[1]);
    const event2EndDate = new Date(year, month, day, event2End[0], event2End[1]);
    
    return (event2StartDate > event1EndDate || event1StartDate > event2EndDate) ? false : true;
 };