I have tried to do the Math Calculation but this is a bit complex to work out in Glide.
function getLifePath(dob) {
const digits = dob.replace(/-/g, ‘’).split(‘’).map(Number);
const reduce = n => {
if ([11, 22, 33].includes(n)) return n;
while (n > 9) {
n = n.toString().split(‘’).reduce((a, b) => a + Number(b), 0);
}
return n;
};
const date = new Date(dob);
const day = date.getDate();
const month = date.getMonth() + 1;
const year = date.getFullYear();
const daySum = reduce(day);
const monthSum = reduce(month);
const yearDigits = year.toString().split(‘’).map(Number);
const yearSum = reduce(yearDigits.reduce((a, b) => a + b, 0));
const total = reduce(daySum + monthSum + yearSum);
return total;
}
return getLifePath(p1); // p1 = Date of Birth input