How can I search before a certain date? YAML


I’d like to use the following in YAML

date_last_spoken: YYYY-MM-DD

However, I can’t find any way either in Obsidian or using online search how I would use a filter in search to find all notes that have a date before a certain date in a filter.

For example all notes before the date_last_spoken: 2023-05-08

Thank you for any help.

I don’t think the native search can do so. Instead, you can use Dataview (community plugin) and write the following content into a note:

WHERE date_last_spoken <= date("2023-09-22")
1 Like

I will try this out to see if it works thank you!

1 Like

@polyipseity This seems to work although lists all of the pages in the vault and not the tags with the date before as the YAML tag. Do you have a solution for this please?

How does your Dataview code look like right now? Did you forget to change the 2023-09-22 to your desired date in the code?

@polyipseity Thank you for your quick reply I appreciate it.
I managed to figure it out so I’ll mark your reply as a solution although for anyone else experiencing the error, I’ll clarify here.

WHERE date_last_spoken <= date("2023-09-31")

Make sure that all of the notes within that folder or note location have the YAML setting at the start of each page with either a blank date_last_spoken: YYYY-MM-DD or the input of the year month and day. If this isn’t in the note(s) it’ll cause them to show up within the search (The blank date_last_spoken: YYYY-MM-DD will cause it to not show up also).

Thanks @polyipseity <3

1 Like

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