Age Calculation

I am trying to calculate age from 2 date fields in pipedrive (see screenshot below).

image

The output of this calculation is a number that is concatenation of the years in both dates.

image

What am I doing wrong?

Appreciate the help.

What is the format you are getting from PipeDrive? Assuming that it is a String instead of date, What you need to do is, first parse the incoming Date in the format received and then the rest of them will be the same,

{{parseNumber(formatDate(parseDate(1.nBdate; "MMM D, YYYY"); "YYYY")) - parseNumber(formatDate(parseDate(1.Bdate; "MMM D, YYYY"); "YYYY"))}}

If it is a date field, which you can review by hovering over the mapping and checking the type associated with it, if that is the case then you can skip the parseDate.

1 Like

Well, after reviewing what you have done, I think there might be an extra space after the subtraction operator(-) :sweat_smile:

It was indeed the stray space after the minus sign.
I was 100% sure I removed every stray spaces, but clearly I was wrong.