Hey guys, I’ve been trying to figure this out for over an hour and i just can’t crack it.
I have User’s birthdays in their thing model. I’d like to simply show how many days away someones birthday is, Formatted as "Birthday: April 25, 12 days away)
Right now, i am doing:
“Current date/time - Contacts Birthday:format as days:rounded to 0 - 365 *-1”
But with this forumla, i am getting numbers like “380 days away”, and i’m not sure how to fix it. I want the number to be between 1-364, of course.
Is the number correct though? If it is, you may need to switch which date is subtracted from which.
The formula I used subtracts the current date from the D.O.B., and I changed the D.O.B. year to the current year so that the D.O.B. date is greater than current date since you’re doing a countdown to a future date.
so if we subtract Current date from birthday we get
X = 10
Y = - 10
And if we subtract Birthday from Current date we get
X = -10
Y = 10
that math checks out, right?
so it looks like regardless of order, we get a negative number. I need a way to tell Bubble to always subtract from 365 or something.
Oh I see what’s happening. I assumed you had years figured into these. Are your formulas including the years? Doing math with dates can work the way you’re after if your data is type date and you’re not leaving out the years in the calculation. That’s why I changed DOB to current year so that those 2 dates are recognized as dates, counting within one year, to get a positive number
Ok! For the one you built, I altered it so that users can select their actual birthdate with their birth year, but then I realized why you were doing it the way you were in the first place - selecting the year is cumbersome.
So then I created the one below it. Check it out. There are conditions in the text elements to cover all bases: when the birthday has passed, when the birthday is coming up, and when the number returned is less than zero (switches the order of operation… that may now be redundant with my other conditions…) but anyway, let me know if this is it.
! looks awesome. Thanks so much! this thread is a true testmanet to bubblers helping each other out.
I will add that i never realized you can change text as a conditional. I can probably clean up ~20 workflows in my projects from just that single tip.
Again, thank you!