As others have mentioned, you need to work with a LOCALE or CULTURE. Here are 2 Google Searches that have a lot of information and answers on this subject:
1.
javascript locale date - Google Search[
^] which give answers like:
javascript Date.prototype.toLocaleDateString() - CodeProject Reference[
^]
2.
javascript culture - Google Search[
^] which gives answers like:
How to detect current culture in javascript - David Guida[
^]
UPDATE
You really need to google to find answers and not demand solutions be done for you. We are volunteers, not paid coders to do free work for you.
Again, research is key. I have done this for you:
js date parse french - Google Search[
^] which gives me this solution:
Parse a date string in a specific locale (not timezone!)[
^] which uses the lib:
Moment.js | Home[
^].
or this search:
js convery french month name to english date - Google Search[
^] which gives two solutions:
How To Convert A Foreign Month In A Date String Into English[
^] which suggests 2 different libs:
GitHub - globalizejs/globalize: A JavaScript library for internationalization and localization that leverages the official Unicode CLDR JSON data[
^] and
Siltaar / month_nb · GitLab[
^] and
GitHub - datejs/Datejs: A JavaScript Date and Time Library[
^] - the second lib looks most promising...
You can do it manually:
let input = "12 mai 1996";
let months = [
"janvier",
"février",
"mars",
"avril",
"mai",
"juin",
"juillet",
"août",
"septembre",
"octobre",
"novembre",
"décembre"
];
let [day, month, year] = input.split(" ");
month = months.indexOf(month) + 1;
let date = new Date(`${month}/${day}/${year}`);
let output = (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear();
console.log(output);
... but then you will need to manually do it for every language that you want to support.
As I said, research is key when you don't know how, or use brute force, just like I have in my code. This is what I have done for you to answer your question.