Dataview plugin snippet showcase

WARNING: Dataview seems to return wrong or at least somehow rounded date calculation results:

Today is 2021-05-04, and a person’s birthday is on 1997-05-17. So she should be 23 years of age today, turning 24 on May 17th.

But when using

`= (date(today) - this.birthday)`

Dataview shows 24 years, instead of 23 years, and something.

I opened an issue on GitHub: Wrong date calculation? · Issue #181 · blacksmithgu/obsidian-dataview · GitHub

I’m assuming @blacksmithgu is using some “forum-like-date-display” code here, where it might be okay to say “someone commented roughly 24 years ago” but I would prefer exact results when working with a database-like system. Otherwise we won’t get good and exact birthday-type calculations, right? :wink:

Hint: If using moment.js, relative time thresholds can be customized: Moment.js | Docs

2 Likes