Have you tried just passing the Glide date column to your YC function as a string, and then using new Date() to convert it to a JS Date object?
This is what I have been doing, and it seems to work fine, regardless of the date format. (Admittedly, I haven’t tested it with every possible format).
Hello @Darren_Murphy
Yes, anyway a YC column with a ‘date-time’ type necessarily arrives in string format (see the readme) so you have to do a ‘new date’. the problem is not the format (short, medium, long) but depending on the regions mm / dd / yyyy or dd / mm / yyyy or other
The problem here Darren is how Glide reads/handles the date, how the user sees it and how JS works with it.
If I’m in Latin America, my date format is dd/mm/yyyy and if this code is executed I will receive an error in my YC column although Glide shows it perfectly.
Example 1
t = '22/3/2021' ; // March 22, 2021
return new Date(t) // Returns “Invalid Date”
Example 2
t = '12/3/2021' ; // March 12, 2021
return new Date(t) // Returns “Fri Dec 3 2021” - wrong date!
JS does not have a Date type as variable unfortunately, any Date value is treated as string
in fact, nobody tested my code , because I solved the problem of the format according to the country dd/mm/yyyy mm/dd/yyyy, … and the format short, medium, long
ah, now I see. The problem is that new Date() can only parse a human readable date if it’s in in English, yes? Maybe you need to pre-process your dates by first passing them through a YC translate column - just kidding
If only everyone could agree that the only truly sensible date format is yyyy-mm-dd, then all these problems would evaporate.
I mean you just have to change the Array Date Format parameter, in your examples you just have to change the medium to long and long to medium in the YC column !!!
If you match the source date column format and YC array it works.