How to find the difference between the Start and End dates of a date-range field?

ss200

Hi @tape-triangle

This is not currently possible in a calculation field (unless I have missed something) you can vote for the feature here: ⭐ Allow usage of date field end date in calculation fields

Either you have to get the dates into two fields or you have to use an automation to do the calculation:

const start = date_field_date_with_end_date_start_date;
const end = date_field_date_with_end_date_end_date;
console.log(`Start: ${start}`);
console.log(`End: ${end}`);

const diff = date_fns.differenceInCalendarDays(date_fns.parseISO(end), date_fns.parseISO(start));

console.info(`Days appart: ${diff}`);

Or as an alternative:

4 Likes

Thanks @Jason , I think my best option is to have two different date fields. This use case does not warrant complication.