The first one is taking the date as a formula and evaluating it, because of the leading "=": 1 divided by 1 divided by 2018 = 0.000495
The second returns what the function returns, which is a date format
Any date in QlikView and Qlik Sense has both a numeric representation, counting from day 1 which is 31/12/1899 and a string representation which is DD/MM/YYYY or whatever the format you have specified in the variables at the beginning of the script or by default, those of the operating system.
Number 3 is very convenient because the numeric value does not change regardless the locale settings of the computer of the developer, the server or the user, and it's always faster to use numeric values instead of strings.
So back to your original issue, you need to make sure that both Deliverydate and the variable return the same format. You can create the Num() equivalent for Deliverydate already in the script, and use it for set analysis and comparisons, and use Deliverydate (date format) for representation in the charts.