Autofill expiration date to last day of the year based off of another date field
I need to set up an auto-fill date field that is the last day of the year based off of another date field.
Example: "Requested Start Date" field is 1/23/23, I need the "Expiration Date" field to auto-fill as 12/31 of the same year as the Requested Start Date Field (so it would be 12/31/23). If someone selects 2/2/24 as start date, I need the expiration date field to be 12/31/24, etc. The expiration date always needs to be the last day of the year of the start date field.
Can anyone help me with the javascript code to do this? I am struggling to get it to work.