Following this previous question :
Hi, I'm looking how to set birthday in FF and relate this with age of user (so the platform can update the age every year). I was thinking use 3 fields (month, year and day) and user can fill them. After, apply a custom function to calculate the age according the current time.
I'm now using a custom function that properly work :
final now = DateTime.now();
int age = now.year - date.year;
if (now.month < date.month ||
(now.month == date.month && now.day < date.day)) {
age--;
}
return age;
My problem is :
When the age is bellow 1 year, the returned age is "0", what i would like is to get as a return "<1"
I have almost 0 knowledge in coding and have tried various things but always ended up with wrong result.
Thank you for your help and time.