[✅ Solution] Calculation Loop not showing formatted date correctly

I created a calculation field to track email records in another app and added the “@ All of Date” variable to get the date and time value from the related field. If I use the Tape regular variable, I get the correct date but inaccurate time.

I attempted to change the format to make the date more readable, but for some reason, the calculation is returning “l” and “n.”

I have no idea why this is happening. I tried using the date.fns library, but I still get the same problem.
Is there a way to fix this?


I’ve switched to date_fns as I seem to have forgotten how to use moment for now but one of the keys is that you have to format the date inside of your loop rather than outside (at least I’m fairly sure that’s the key).

Anyway the following seems to work for me.

const id = @All of Job Ref;
const url = @workList URL;
const title = @All of Name;
const date = @All of Created on;
const timezone = 'America/New_York'; // Define the desired timezone

let html = "<ol>";

for (var i = 0; i < id.length; i++) {
    const formattedDate = date_fns.format(new Date(date[i]), 'EEE, MMM/dd/yy HH:mm', { timeZone: timezone }); // Format the date inside your loop
    html += `<li><a href='${url}${id[i]}'>${title[i]}</a> |  ${formattedDate}</li>`;
html += "</ol>";


That worked. Thanks. It didn’t occur to me to put the format date inside the loop.

1 Like