However, I’ve just realised that formula doesn’t quite do exactly what you are looking for. It adds a given number of business days to a start date, whereas you want to calculate the number between two dates. So it would need to be modified somewhat.
@tuzin is always up for a challenge. He might do that if you ask him nicely
Oh great!
I’m new to this forum
I’ll explain what I need
I need to put a start date in a “date entry” and an end date in another “date entry”, and I need to have a list of all the working days in a sort of “join list”.
Do you understand? And will you be able to help me?
My setup, tested in Safari, which has been problematic with Date functions in JavaScript in the past.
Date Start & End, user-specific columns, Date Pickers write into these columns.
Timezone: gotta have this to use in the JS function, since Glide seems to return UTC-based values in the JS function instead of returning it as is. Say I choose 15th Feb, it returns a Zulu timestamp of 5PM 14th Feb (I’m UTC+7).
Working Days JS: JavaScript column.
const timezoneOffset = parseInt(p3, 10);
const start = new Date(p1);
const end = new Date(p2);
start.setHours(start.getHours() + timezoneOffset);
end.setHours(end.getHours() + timezoneOffset, 59, 59, 999);
let currentDate = new Date(start);
const workingDays = [];
while (currentDate <= end) {
if (currentDate.getDay() >= 1 && currentDate.getDay() <= 5) {
workingDays.push(currentDate.toISOString().split('T')[0]);
}
currentDate.setDate(currentDate.getDate() + 1);
}
return workingDays.join(', ');
It can also be done with a helper table, but that certainly isn’t a single column solution, and the maximum date range would be limited to the number of rows in the helper table.