Hello, I have the following error message: “6 févr. 2025’ is not a valid date or does not match the date format.”
Date Format Feb.pdf (52.7 KB)
This is related to my question here:
It looks like formatDate() only works in English so you’ll have to address it differently.
One way is to extract the month and do a switch on it:
{{ switch(first(slice(split(1.month; space); 1)); jan.; 1; févr.; 2; fevr.; 2) }}
Although this doesn’t work because the condition always resolves to FALSE. I need to take a minute to understand why but I don’t have the time right now. Hopeflly it ses you on the right track.
I will need it at some point too so I’ll work on it when I can.
L
Thanks for your precious help. Would this formula be ok?
{{formatDate(parseDate(switch(formatDate(parseDate(1.Date; “DD MMM. YYYY”); “MMM”; fr);
janv.; “01”; févr.; “02”; mars; “03”; avril; “04”; mai; “05”; juin; “06”;
juil.; “07”; août; “08”; sept.; “09”; oct.; “10”; nov.; “11”; déc.; “12”)
& formatDate(parseDate(1.Date; “DD MMM. YYYY”); " DD YYYY"); “DD/MM/YYYY”)}}
HI,
I’m not sure. The best way to know is to check step by step. For exampl, in the formulat I gave, I started by checking the the most “internal” part worked (so the slice part which extracts the month from “7 févr. 2025”), then the switch, then I soud add the formatDate. It’s a bit tedious but then you know exactly how piece is working.
One thing to note: make sure that your months are not surrounded by a solid color. For example, if you cut and paste your codein make, you get this:
Make thinks that “fr”, “janv.”, etc… is a variable inside a module. That will make the function fail. So you will need to modify them so they look like this:
(quotes around the months as for janv. and févr.)
{{formatDate(parseDate(switch(formatDate(parseDate(1.Date; "DD MMM. YYYY"); "MMM"; fr); "janv."; ""; "févr."; ""; mars; ""; avril; ""; mai; ""; juin; ""; juil.; ""; août; ""; sept.; ""; oct.; ""; nov.; ""; déc.; "") & formatDate(parseDate(1.Date; "DD MMM. YYYY"); " DD YYYY"); "DD/MM/YYYY"))}}
Hopefully that helps,
L
Thank you for your involvement. Unfortunately I don’t yet have the mastery of Make to juggle regex like you do. Thank you anyway for your involvement
It’s not regex, it’s a function. You can learn more about them here:
https://academy.make.com/courses/IntermediateC06
But actually, regex might work better. So I’m attaching a blueprint that uses regex instead. It’s not complete, but it’s not that hard to finish.
Here is the explanation:
In the first module I set the variable with the date I want to parse.
In the text parser, I split the date in three using this regex pattern:
(\d{1,2})\s([a-zéû.]+)\s(\d{4})
(\d{1,2})
→ Captures the day, which can be 1 or 2 digits.\s
→ Matches the space separator.([a-zéû.]+)
→ Captures the month, which consists of letters (including accented ones) and possibly a dot (févr.
).\s
→ Matches the space separator.(\d{4})
→ Captures the year, which is always 4 digits.
Then in the output I get something like this:
I now have the three components of my date which I can parse with parseDate().
Normally, the parseDate() would look like this:
{{parseDate(5.`$3` + "-" + 5.`$2` + "-" + 5.`$1`; "YYYY-MM-DD")}}
But Make doesn’t understand “févr.” “mars” “août” etc. So I need to map them to a number:
jan. → 1
févr.-> 2
etc.
I do that with the switch() function:
switch(5.`$2`; "jan."; 1; "févr."; 2; "mars"; 3)
Which basically means:
- If $2 is “jan.” use “1”
- If $2 is “févr.” use “2”
- If $2 is “mars” use “3”
Do that for all of the months of the year and the switch statement will be complete.
{{parseDate(5.`$3` + "-(" + switch(5.`$2`; "jan."; 1; "févr."; 2; "mars"; 3) + "-" + 5.`$1`; "YYYY-MM-DD")}}
Then that should work for you.
L
formatFrenchDate-blueprint.json (8.3 KB)