Selecting Variant Based on Custom (Date) Input Product fields

I have a product that is a rental, it has a delivery and a pickup date as custom attribute input fields on the product.

My product has multiple variants that impact pricing for example if delivery is on a Monday to Friday, Saturday, or Sunday will each be a different variant priced differently. Also short term rentals are priced differently than longer term rentals (7+ days).

What I’d like to do is for a customer to only enter a FromDate and a ToDate and to have the right combination of variants selected. I’m not sure where to get started. Is it possible for a javascript to push a variant selection? Variant ID is dynamic, but each Variant category has data-option=“option1” … option2, etc.

So would need for example to check Day of Week of From Date and have it select Option Value “Saturday” (for example) for option2 variant.

I’m able to handle the date logic in javascript, but how can i take that output and use it to select a variant option?

TLDR: I did a terrible job explaining this. I have a javascript that puts out an output - for example either “Long Term” or “Short Term”. The product has a variant with those two options.

Is there any way I can have the output of the script ‘pre-select’ the appropriate variant?