Combine date fields to auto fill a different field with custom formatting
I'm trying to auto fill a custom formatted field ("days") by combining two date fields ("day 1" and "day 2") with "and" in the middle. For example, if the user selects 6/2/2023 in the "day 1" field and 6/3/2023 in the "day 2" field, I want the "days" field to auto fill with "Friday, June 2nd, and Saturday, June 3rd".
I've added Custom Format Script and Custom Calculation Script to the "days" field and my dates are combined but not reformatted. I can't get the custom formatting to add the st, nd, rd or th to the day and drop the year.
MY CUSTOM FORMAT SCRIPT:
var date1 = this.getField("day1").value;
var date2 = this.getField("day2").value;
event.value = date1 + " and " + date2 + ".";
