Determine date value without date tokens?

I have a form on my website where someone can indicate their scattered days of availability for work. They enter each of the dates on a new line, then submit the form. The form connects to Make via webhook, and the dates are passed to Make as a string.

This is the best way I can come up with to corral this data, due to some limitations with the software I’m using (Softr).

I have indicated on the form: “Date submissions should use the format MMM DD YYYY, for example MAR 5 2026”

However, not everyone sees/understands/follows this instruction. I’m wondering if there’s any function or module where Make can intuit what the date is from the string, then I can use formatDate() and parseDate() as needed to connect to my calendar database.

That way, users can enter dates however they please (so long as year/month/date are all included).

Hi @justinjtessier,

without looking a bit deeper into the possibilities, the first thing i can think of is to get the first date, connect the ChatGPT API with 4o mini and tell it to output only the format. You can then use that with the parseDate function.

That, however, required for the user to have all the dates they enter in the same format.

Would that be something that could work in your use case?

I would’ve said use a date selector, but since they paste a number of dates in there, this probably won’t work.

Yeah date selector won’t work (as far as I know) – I’m using Softr as the front end and sending the form data directly to Make.

The number of dates input by a user will vary on a case-to-case basis, so I can’t use multiple date selector fields.

This led me to using a “long text” input field, converting the string to an array with split(), and then using an Iterator module to mark the relevant dates in a Dates database.

The ChatGPT module is certainly a good idea, but I’m worried about usage limits/token values etc. creating chokeholds… unless in this use case the usage would be so low that I wouldn’t need to worry about that? Which I could see, if all it’s doing is figuring out a date format…

I see what you mean, but if you’re using 4o mini and only have the super short input like "Reply with the the Format of the following Date without any other comments: {{ DateHere }}“
and you get an output like "MMM DD YYYY“, then it is very very cheap.

But I don’t know how many people fill that out.

I recommend you set that automation up (super quick setup) and test it as much as you like keeping a look at the expenses page in the OpenAI platform. That way you can also make sure that It outputs the correct format each time.

You could otherwise also check for the most common format with JavaScript. There are several integration that allow you to run JavaScript and return the result.
Here is a quick script I made with ChatGPT where you can input all the most common formats. I didn’t test it, but something like this should work:


function parseDate(input) {
  const moment = require('moment'); // Requires Moment.js library
  const formats = [
    'YYYY-MM-DD',   // ISO format
    'MM/DD/YYYY',   // US format
    'DD/MM/YYYY',   // European format
    'MMMM D, YYYY', // Long-form (e.g., January 1, 2024)
    'D MMM YYYY',   // Short month format (e.g., 1 Jan 2024)
    'YYYY/MM/DD',   // Alternative ISO format
  ];

  for (const format of formats) {
    const parsedDate = moment(input, format, true); // Strict parsing
    if (parsedDate.isValid()) {
      return { isValid: true, format: format, date: parsedDate.toDate() };
    }
  }

  return { isValid: false, message: 'Date format not recognized' };
}

// Example usage:
const dateInput = '12/20/2024'; // Replace with the input date string
const result = parseDate(dateInput);

if (result.isValid) {
  console.log('Date is valid:', result.date);
  console.log('Detected format:', result.format);
} else {
  console.log(result.message);
}