Between Condition not working

I am attempting to calculate Age in months from the DoB - date of birth summited by a user.
if The computed age is between 35 - 45 then the condition is true.
I have tried using the BETWEEN condition but somehow it is not working.
When I test with the date 08-08-1977 it evaluates to true. What am I doing wrong

$_POST.a01_DoB.dateDiff('months', '2022-07-08'.between(420, 540))&&($_POST.a02_currentRank <= 8 && ($_POST.a02_DateAppointedPresent.dateDiff('months', '2022-07-08') >= 47.9))

You mean when you replace the dynamic $POST_values with 08-08-1977?
What value exactly does your form input actually submit? Have you tried outputting:



$_POST.a01_DoB.dateDiff('months', '2022-07-08'.between(420, 540))

in two separate set value steps with the output on to see the exact values returned?

my form input a01_DoB submits a date in the form mm-dd-yyyy

Most dates in programming, including these formatters, are expected in the format yyyy-MM-dd

Are you using a date picker on your page to choose the date?

no please. using the Text input with Type set to Date. Bootstrap generated form

You should have the option for the input to convert to datepicker

I answered wrongly yesteday. The date inserted into the DB is in the form yyyy-mm-dd and not the other way round