How to set the value for a duration variable in the workflow

I'm looking into using the wait function and delay a workflow until a date has passed, eg Project End date that was entered into the start form, the duration of this delay has to be a duration data type variable.
To that end I have built a function to calculate the days difference between dates however its output is a number format, it won't accept a duration data type as the output.
So how do I then update my duration variable with the output of my function?

image.png