Getting the locale date
The toLocaleDateString method on the date object lets you pass in the locale of choice and returns a string formatted date with forward slash separators.
Replacing the slash
To replace the forward slash with a dash is as easy as manipulating the string with a replace regex.
To get the written representation of the date in the chosen locale toLocaleDateString accepts a second options param where you can specify