After revisiting this script, and some modifications, the following is available to allow a user to add a feature that calculates the expected delivery date.
Change line 7 from
ship.setDate( safety ); // add a number of days
to
ship.setDate( ship.getDate() + safety );
The problem was that you want to add days, not set days.