Skip to content

Instantly share code, notes, and snippets.

@evaera
Last active February 14, 2024 18:42
Show Gist options
  • Save evaera/5d8aabf6f74a37ce509296a4f31fb6a7 to your computer and use it in GitHub Desktop.
Save evaera/5d8aabf6f74a37ce509296a4f31fb6a7 to your computer and use it in GitHub Desktop.
Notion Next Birthday Formula

Notion Next Birthday Formula

Given a field called Birthday (of which only the day and month are used), the Next Birthday Formula will be the date of their next birthday. It will be this year if their birthday hasn't passed yet, or next year if it is past their birthday.

Made by @lpghatguy and @evaera

The Formula

if(empty(prop("Birthday")), prop("Birthday"), dateAdd(dateAdd(dateAdd(dateAdd(fromTimestamp(0), toNumber(formatDate(prop("Birthday"), "D")) - 1, "days"), toNumber(formatDate(prop("Birthday"), "M")) - 1, "months"), toNumber(formatDate(now(), "Y")) - 1970 + if(toNumber(formatDate(now(), "M")) >= toNumber(formatDate(prop("Birthday"), "M")), if(toNumber(formatDate(now(), "D")) > toNumber(formatDate(prop("Birthday"), "D")), 1, 0), 0), "years"), 24 - toNumber(formatDate(fromTimestamp(0), "H")), "hours"))
@CandDid
Copy link

CandDid commented Feb 14, 2024

Hi, is there any way you could explain how this formula works?

I'm not sure how to apply it to my use case. My team wants to be able to hide the age of the person - so not save any year, but still have a calendar :"D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment