Because d1 is not a Date object, but a number. Date.parse returns the milliseconds representation, you will need to feed that into new Date or use the Date constructor directly.
And because JavaScript does not have a native date-formatting function, there are only the implementation-dependent toString and toLocalString  and the standardized toISOString and toUTCString (though not supported in older IE). Instead, you will have to do the formatting manually by getting the single components and concatenating them. Luckily, there's a bunch of libaries to help you with that.