When the calculations are performed the console shows an error that says that t.toISOString is not a function.
However, if I enter the appropriate code in the browser console it performs without error and returns the correct output.
e.g. new Date().toISOString().slice(0,10) returns the current date as "2018-09-26" as expected.
You should be able to use momentjs for calculation and date formatting
thanks for the suggestion; that worked.