Last active
August 13, 2025 09:39
-
-
Save dsebastien/2cdc1390b85d69aba9fbf205169e329b to your computer and use it in GitHub Desktop.
Obsidian Base Formula that calculate people's age (current, at death, died x years ago, ...)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(date_of_birth && !date_of_birth.isEmpty(), if(date_of_death && !date_of_death.isEmpty(),"Died at "+ (if(/\d{4}-\d{2}-\d{2}/.matches(date_of_death.toString()), date(date_of_death),date(date_of_death.toString() + "-01-01")) - if(/\d{4}-\d{2}-\d{2}/.matches(date_of_birth.toString()), date(date_of_birth), date(date_of_birth.toString() + "-01-01"))).years.round() + " (" + (date(now()) - if(/\d{4}-\d{2}-\d{2}/.matches(date_of_death.toString()), date(date_of_death), date(date_of_death.toString() + "-01-01"))).years.round() + " years ago)", (date(now()) - if(/\d{4}-\d{2}-\d{2}/.matches(date_of_birth.toString()), date(date_of_birth), date(date_of_birth.toString() + "-01-01"))).years.round()), "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment