Hello, I’ve been working on creating new events on a Google Calendar from Make. However, I have used multiple date formats, and I keep getting a very frustrating problem. My current date format is US-standard MM-DD-YYYY. Example 10-31-2024 will create an event on October 31st, 2024. But 10-03-2024 will create an event on March 3rd, 2024! I can’t figure out the “correct” date format for the Start Date and End Date parameters. It seems like it is looking for a valid date in DD-MM-YYYY format and then if it doesn’t return a valid date there, it switches to MM-DD-YYYY. What’s the right away to do this?
Here’s my “code”:
{{formatDate(21.MyAvailability[36.ItemNumber].StartingDate; “MM-DD-YYYY”)}} {{substring(21.MyAvailability[36.ItemNumber].StartTime; 0; 5)}}
It’s because Make is not interpreting your variable as a date, but as a string. So when you use formatDate(“your string”) it tries to see if it’s DD-MM-YYYY (the standard American format) and if so, it keeps it. If it doesn’t work, it tries MM-DD-YYYY.
Hi, guys, I’m still getting this error even after adding parsedate. Here’s my code:
Start Date: formatDate(parseDate(21. MyAvailability.StartingDate;YYYY-MM-DD);MM-DD-YYYY) substring(21. MyAvailability.StartTime;0;5
Are you parsing the correct thing? I thought you were parsing “10-03-2024” but it seems you’re parsing “2024-04-11T23:00:00.000Z” or something else I’m not seeing. Unless I’m mistaken, you need to tell the parser the exact format of your date (including the timezone in this case).
If I’m misunderstanding, I recommend you create a test scenario where you put in a Set Variable module where you put the exact data you’re having problems with and then share that scenario. It should be easier to debug.