I have
const endDate = new Date(year + "-" + month + "-" + date + "T" + endHour + ":" + endMinute + ":00").toUTCString();
in my code to initialize a date object and then convert it to a UTC string, but it returns Invalid Date on Safari. I also tried "MM/DD/YYYY" format for the date part and it did not work either. The variables used are correct because the code works fine on Chrome.