Question: ========================Javascript====================================================== Given a date string in the format Day Month Year, where: Day is in the set fIst 2nd 3rd 4th 5th 6th7th8th9th29th 30th 31st)
========================Javascript======================================================
Given a date string in the format Day Month Year, where: Day is in the set f"Ist "2nd" "3rd "4th "5th "6th"7th"8th"9th""29th" "30th "31st") . Month is in the set f'an Feb' Mar "Apr "May*Jun, Jul" "Aug. "Sep "Oct" Nov. "Dec" Yearis in the inclusive range f1900, 2100 Convert the date string to the format YYYY-MM-DD, where: YYYYdenotes the 4 digit year. MM denotes the 2 digit month. . DD denotes the 2 digit day For example: 1st Mar 1984 1984-03-01 2nd Feb 20132013-02-02 1900-04-04 4th Apr 1900 Function Description Complete the function reformatDate in the editor below. The function must return an array of converted date strings in the order presented. reformatDate has the following parameter(s): datesfdatesfo)!... datesn-1l1: an array of date strings in the format Day Month Year Constraints . The values of Day, Month, and Yearare restricted to the value ranges specified above. The given dates are guaranteed to be valid, so no error handling is necessary Input Format for Custom Testing Sample Case o Sample Input 0 10 20th Oct 2052 6th Jun 1933 26th May 1960 20th Sep 1958 16th Mar 2068 25th May 1912 16th Dec 2018 26th Dec 2061 4th Nov 2030 28th Jul 1963 Sample Output o 2052-10-20 1933-06-06 1958-09-20 Given a date string in the format Day Month Year, where: Day is in the set f"Ist "2nd" "3rd "4th "5th "6th"7th"8th"9th""29th" "30th "31st") . Month is in the set f'an Feb' Mar "Apr "May*Jun, Jul" "Aug. "Sep "Oct" Nov. "Dec" Yearis in the inclusive range f1900, 2100 Convert the date string to the format YYYY-MM-DD, where: YYYYdenotes the 4 digit year. MM denotes the 2 digit month. . DD denotes the 2 digit day For example: 1st Mar 1984 1984-03-01 2nd Feb 20132013-02-02 1900-04-04 4th Apr 1900 Function Description Complete the function reformatDate in the editor below. The function must return an array of converted date strings in the order presented. reformatDate has the following parameter(s): datesfdatesfo)!... datesn-1l1: an array of date strings in the format Day Month Year Constraints . The values of Day, Month, and Yearare restricted to the value ranges specified above. The given dates are guaranteed to be valid, so no error handling is necessary Input Format for Custom Testing Sample Case o Sample Input 0 10 20th Oct 2052 6th Jun 1933 26th May 1960 20th Sep 1958 16th Mar 2068 25th May 1912 16th Dec 2018 26th Dec 2061 4th Nov 2030 28th Jul 1963 Sample Output o 2052-10-20 1933-06-06 1958-09-20
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
