How can I add 6 months to a date in a glide table?

Im trying to calculate a warranty expiry date for 6 months after the sold date. Unfortunately glide only seems to be able to add in days and im trying to calculate exactly 6 months after the date sold. Any ideas or help would be appreciated.

See below:

2 Likes

I tried using his formula and some of the values are incorrect. Maybe i’m implementing it wrong. Watching Darrens video now

Got it working thank you

Excellent :+1:

Here’s a no-code and a low-code way of doing this:

var dateInput = p1;
var inputDate = new Date(dateInput);

// Adding 6 months to the input date
inputDate.setMonth(inputDate.getMonth() + p2);

// Get the updated date components
var year = inputDate.getFullYear();
var month = ('0' + (inputDate.getMonth() + 1)).slice(-2); // Adding 1 to the month since it is zero-based
var day = ('0' + inputDate.getDate()).slice(-2);

// Constructing the updated date string
var updatedDate = year + '-' + month + '-' + day;

return updatedDate;
4 Likes