Hey @keith and @dan1, thank you for showing me those expressions, but there is a flaw in the expressions, there are not 100% accurate, it could show me the age of a user if the birth date is 10 or more days away in the future, I did try everything with expressions with no 100% results, I am going to show you how I did it more than 2 years ago and is working perfect, (btw, my question about recurring workflows it wasn’t related to the age of an user it was related to how to show the birth date in the calendar bubble has embed it, my bad, I will keep looking how to do it) but first take a look:
(FOR THE SAKE OF THIS POST TODAY IS 09/27/2018)
this is my real birth date showing my age:
Here you can see my real Birth date, which is a couple of months away, it is showing the correct age in both cases.
Now lets try to hard code my birth date to a day like today in 1976 in the app data for users:
It works perfect in both cases, today it would be my 42 birthday, I would be 42 years old.
The problem begins here, lets say my birthday is tomorrow in 1976:
My way it is showing it correctly, today I am still 41 and tomorrow I will be 42, your way on the other way it is not correct, is showing 42 y/o.
Lets change the date for 10 days from now 10/07/1976:
Still we have the same problem.
Now if we change it for 11 days from now 10/08/2018:
Both cases are showing the correct age.
that is why I say your way it is not 100% perfect, I can’t have that gap of 10 days in my app, i need to check the age of my users every single day, and because we have birthdays every day this has to be perfect.
I tried every single way of writing expressions to show the correct age with no luck, I got stuck for a couple of months until I found a solution I am showing here:
First I created this event when the page is loaded:
I change some fileds (index) in every user for year of birth , month of birth and day of birth:
For the year I subtract from the current year the year of the birth of the user, in my example: 2018-1976 = 42
For the month I subtract from the current month of the year the month of the birth of the user and divide by 12, in my example: (09-12)/12 = -0.25
For the day I subtract from the current day of the year the day of the birth of the user and divide by 365.25, in my example: (27-23)/365.25 = 0.0109514031485284
Then in a following event also when loading the page I add all this numbers to another field from the same user:
So this field is: 42+(-0.25)+0.0109514031485284 = 41.76095140314853
Then I show this filed as the age and floorit!
And always get a correct age.
Lets repeat the exercise with the dates showed before for today, lets say I was born 09/27/1976:
2018-1976 = 42
(09-09)/12 = 0
(27-27)/365.25 = 0
42+0+0 = 42
Total 42 ! Correct Today would be my 42 birthday today ma age would be 42 (42 floor is 42)
Lets say yesterday was my birth day, 09/26/1976
2018-1976 = 42
(09-09)/12 = 0
(27-26)/365.25 = 0.0027378507871321
42+0+0.0027378507871321 = 42.0027378507871321
If we floor 42.0027378507871321 the answer is correct I would got 42 yesterday.
Now, lets say my birthday is tomorrow, 09/28/1976:
2018-1976 = 42
(09-09)/12 = 0
(27-28)/365.25 = -0.0027378507871321
42+0+(-0.0027378507871321) = 41.99726214921287
If we floor 41.99726214921287 the answer is 41, !!! Today I am still 41 so this works flawlessly!!!
I am not going to lie guys, I was so happy when I did this, when I finally found the way of displaying the correct age of an user every single time. Again, I did more than 2 years ago, and even trying to remember all this to explain it to you, brought me joy . There could be another million options, but this is the one I made up and works 100%, works for me!
I hope all this make sense, I know I had to use the workflow and events and fields from the user instead of a simple expression, but this works!!!
Please let me know if you have any question, I still have my question about the recurring workflow for m y calendar.
Cheers!