Created
October 21, 2019 20:24
-
-
Save jeanlescure/16ab8f1103337999b6275078e9d7a37a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Given a string containing a list of dates in either format dd/mm/yyyy or mm/dd/yyyy | |
// where there's one date per line within the string | |
let a=`28/09/2019 | |
30/09/2019 | |
30/09/2019`; | |
// Reverse the date's day and month values and return a string with same input format | |
a = a.split("\n").map((d)=>d.split('/')).map((da)=>([da[1],da[0],da[2]]).join('/')).join("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment