You can easily achieve this by splitting the string into an array based on the "." separator, and then reformatting it into a date string using template literals.
index.tsx185 chars7 linesIn this code, we first declare the input dateString as a string with the value "05.11.2022". We then split the string into an array called [day, month, year] using split(".") method.
Next, we reformat the date with template literals and store the value in formattedDate variable.
Finally, we log formattedDate to the console, which should output the string "11/5/2022".
gistlibby LogSnag