Dataview: Days until birthday

I have a database with entries like this one:

# Jane Doe
birthday: 2000-01-01

What I’m trying to do

I want a table on my homepage, showing upcoming birthdays, with the columns:
Name (of the person), Day (e.g. January 01), Which (aka how old will they be), Days until (time in days from now to the birthday this year).

I managed to “create” the ‘birthday this year’ from the birthday like this: (dateformat(birthday, (this.file.mday.year) + "-MM-dd")) AS "birthday this year"

I struggle with the “Days until” column, I thought that it must be something like (birthdayThisYear - this.file.mday), but when I copy paste the line above into birthdayThisYear like this: ((dateformat(birthday, (this.file.mday.year) + "-MM-dd")) - this.file.mday) AS "days until",, I get following error message:
"Dataview: Every row during final data extraction failed with an error; first 7:

        - No implementation found for 'string - date'
  • No implementation found for ‘string - date’
  • No implementation found for ‘string - date’"

This is what I have already:

  dateformat(birthday, "MMMM dd") AS "Day",
  round((this.file.mday - birthday).years) AS "Which",
  (this.file.mday - birthday) AS "days until",
  (dateformat(birthday, (this.file.mday.year) + "-MM-dd")) AS "birthday this year"
FROM "people"
SORT birthday.month ASC

I don’t get that error when running your query. Maybe you just need to restart Obsidian, or update Dataview to get it working?

If neither of the above helps, please try removing one of the columns until you discover which line is causing it to fail.

Or you could also try doing:

TABLE typeof(this.file.mday), this.file.mday, typeof(birthday), birthday
FROM "people"
SORT birthday.month ASC

This query should reveal which types it thinks the different parts are, and maybe you’ll see which entry/entries causing you grief.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.