Filtering base fore recent notes

What I’m trying to do

How do I filter a base to list recent notes from the last 30 days?

Things I have tried

filters:
  and:
    - dateAfter(now(), dateModify(now(), -30 days))
views:
  - type: table
    name: Table

Any of this could change before the stable release, but currently…

The duration in dateModify is a string, so it needs quotation marks: “-30 days”.

Your filter compares “now” to “now -30 days”, which is always TRUE and would show every note. Now is always later than 30 days ago. So if you want to compare to the file’s implicit modified time (file.mtime), put that in place of the first now(). Like:

dateAfter(file.mtime, dateModify(now(), "-30 days"))

If you want to use a custom property that you manually update for the last modified date, put its name in there instead.

1 Like

Hey dawni, could you please help me with this:
I want to filter my tasks by a property, named Faellig (my due date for the tasks),
and I want to see only the tasks for the next 7 days. How would you do this?


Thank you very much for helping me, in advance.

Maybe this could work :blush: :

where dateOnOrAfter(property.Faellig, date(now()))
and dateOnOrBefore(property.Faellig, date(dateModify(date(now()), "7 days")))

1 Like

thank you very much!

1 Like

It’s a question I’ve been thinking about myself. Here’s what I came up with, to generate for each day a table with the following filter formula: dateEquals(date(file.mtime), dateModify(date(“2025-05-31”), “-0 days”))

This is a .base code-block that I’ve inserted in my “Daily Notes” template. My daily note title is formatted YYYY-MM-DD, and when I open it for the first time each day, I use a hotkey to run the command Templater: Replace templates in the active file. That gives me an .base table in my daily note. Very convenient. You do need the “Templater” plugin, though.

Notes modified on <% tp.file.title %>

formulas:
  Modified: ""
display: {}
views:
  - type: table
    name: Modified on today's date code
    filters:
      and:
        - dateEquals(date(file.mtime), dateModify(date("<% tp.file.title %>"), "-0 days"))
    order:
      - file.name
      - file.mtime
      - file.ctime        
      - file.folder
      - tags
    columnSize:
      file.name: 490
      file.mtime: 200
    sort:
      - column: file.mtime
        direction: DESC
      - column: file.folder
        direction: ASC
limit: 50

Very clever AutonomyGaps

I like it :slight_smile:

I tried creating a Base and pulling it in as a Embedded Base but it won’t execute the Templater Formula which means I have to manully add the date.

1 Like

If it’s in your daily note, I’m not sure you need the dateModify() :thinking:

You could potentially use:

dateEquals(date(file.mtime), date("<% tp.file.title %>"))

This is untested though :blush:

Note that syntax breaking changes for bases were announced not too long ago on Discord for an upcoming release so this could potentially break at some point and you might have to edit your daily notes afterwards :face_without_mouth:

Tested it with

formulas:
  Date-Modified: date(file.mtime)
  Date-Created: date(file.ctime)
views:
  - type: table
    name: Modifed Today
    filters:
      or:
        - dateEquals(date(file.mtime), date("<% tp.file.title %>"))
    order:
      - file.name
      - formula.Date-Modified
      - file.folder
    sort: []
  - type: table
    name: Created Today
    filters:
      or:
        - dateEquals(date(file.ctime), date("2025-06-01"))
    order:
      - file.name
      - formula.Date-Modified
      - formula.Date-Created
      - file.folder
    sort: []

After Template Executes comes in empty

Can’t see the embedded templater syntax in embedded base

If I manually change to date though it shows nicely :wink:

Will keep working on it tomorrow :wink:

I don’t think there’s a way at this early stage of base development to programmatically access/read/parse/manipulate a .base file from within Obsidian :smile:

This will probably come when Obsidian’s API is updated to include base related things I guess :sweat_smile:

Using a base code block like AutonomyGaps did works though :blush:

You needn’t run Replace Template. Since the name or your daily note is YYYY-MM-DD, you can reference it as the date you want to modify:

dateEquals(date(file.mtime), dateModify(this.file.name, "-0 days"))

With that, you could put the full code block in your template if you want, or you could save it as a .base and embed it with only one line in your template:

![[modified-today.base]]

… or whatever you decide to name it.

1 Like

Seems to sort of work but the results were incorrect

Original Base

formulas:
  Date-Modified: date(file.mtime)
  Date-Created: date(file.ctime)
views:
  - type: table
    name: Modifed Today
    filters:
      or:
        - dateEquals(date(file.mtime), dateModify(this.file.name, "-0 days"))
    order:
      - file.name
      - formula.Date-Modified
      - file.folder
    sort: []
  - type: table
    name: Created Today
    filters:
      or:
        - dateEquals(date(file.ctime), dateModify(this.file.name, "-0 days"))
    order:
      - file.name
      - formula.Date-Modified
      - formula.Date-Created
      - file.folder
    sort: []

Embed in Daily Journal Template
![[modified-today.base]]

RESULT
Different that Dataview Output

Okay. I was talking to AutonomyGaps’ about their use of date("<% tp.file.title %>") and “Replace templates” to insert a date that this.file.name can get from that day’s note.

I don’t know about your (or their) formulas. Or why you chose “-0 days”. But I hope it works out for you.

Options atm seem to be

1. The original embedded formula trigger by Templater

formulas:
  Modified: ""
display: {}
views:
  - type: table
    name: Modified on today's date code
    filters:
      and:
        - dateEquals(date(file.mtime), dateModify(date("<% tp.file.title %>"), "-0 days"))
    order:
      - file.name
      - file.mtime
      - file.ctime        
      - file.folder
      - tags
    columnSize:
      file.name: 490
      file.mtime: 200
    sort:
      - column: file.mtime
        direction: DESC
      - column: file.folder
        direction: ASC
limit: 50

2. Embed the Base then update manually

formulas:
  Date-Modified: date(file.mtime)
  Date-Created: date(file.ctime)
views:
  - type: table
    name: Modifed Today
    filters:
      or:
        - dateEquals(date(file.mtime), date("2025-06-01"))
    order:
      - file.name
      - formula.Date-Modified
      - file.folder
    sort: []
  - type: table
    name: Created Today
    filters:
      or:
        - dateEquals(date(file.ctime), date("2025-06-01"))
    order:
      - file.name
      - formula.Date-Modified
      - formula.Date-Created
      - file.folder
    sort: []

3. Stick with Dataview for now

Files Created Today

TABLE without ID 
  file.link AS "File",
  dateformat(file.ctime, "yyyy-MM-dd") AS "Created"
FROM ""
WHERE file.ctime >= date([[<% tp.date.now('YYYY-MM-DD') %>]]) AND file.ctime < date([[<% tp.date.now('YYYY-MM-DD') %>]]) + dur(1 day)
SORT file.ctime DESC
LIMIT 10

Files Modified Today

TABLE without ID
  file.link AS "File",
  dateformat(file.mtime, "yyyy-MM-dd") AS "Modified"
FROM ""
WHERE file.mtime >= date([[<% tp.date.now('YYYY-MM-DD') %>]]) AND file.mtime < date([[<% tp.date.now('YYYY-MM-DD') %>]]) + dur(1 day)
SORT file.mtime DESC
LIMIT 30

Still early days with Bases, Im sure will be more options in the coming weeks

Using dawni’s suggestion I seem to have it working, for files modified on a given day, without having to use a Templater replacement. It gives the same results as the dataview query I’ve used historically. Not sure if this will suit your needs:

base
filters:
  and:
    - file.folder != "Daily"
    - file.ext != "base"
formulas:
  Date-Modified: date(file.mtime)
display:
  file.name: File
  formula.Date-Modified: Modified
views:
  - type: table
    name: Modified Today
    filters:
      and:
        - dateEquals(date(file.mtime), dateModify(this.file.name, "-0 days"))
    order:
      - file.name
      - formula.Date-Modified

I’m using an embedded base rather than linking but it shouldn’t make any difference to the results.

This is the equivalent dataview code, with Templater replacing the day’s date:

dataview
TABLE file.mtime as Modified 
FROM "" 
WHERE date(2025-06-02T23:59) - file.mtime <= dur(24 hours) AND date(2025-06-02T23:59) - file.mtime > dur(0 hours) AND file.folder !="Daily"
SORT file.mtime asc

And here’s the results of both:

2 Likes

I just LOVE this community! Great suggestions. Thanks for taking what I had and running with it @PaulDickson @dawni @symph0nic !

Here’s what I’ve settled on for now:

My daily note embeds this .base note, with the view specified:

![[Table of modified on date in title of daily note.base#Today’s modifications]]

The elements that I include are the TIME of modification (I don’t need the day, since that’s in the title of the Daily Note). But I do like to have the Created and the Folder columns, for context. This gives me a really useful chronological overview of the day.

Thanks!

formulas:
  Modified: date(file.mtime)
  ModTime: time(file.mtime)
  Created: date(file.ctime)
display:
  formula.Modified: Modified
  formula.Created: Created
views:
  - type: table
    name: Today's modifications
    filters:
      or:
        - dateEquals(date(file.ctime), dateModify(this.file.name, "-0 days"))
        - dateEquals(date(file.mtime), dateModify(this.file.name, "-0 days"))
    order:
      - file.name
      - formula.ModTime
      - formula.Created
      - file.folder
    sort:
      - column: formula.ModTime
        direction: ASC
    columnSize:
      file.name: 616
      formula.ModTime: 131
      formula.Created: 131
      file.folder: 607
2 Likes

Nicely done. Yeah I was just using the date column to confirm the data was correct.

One thing that’s interesting, and may or may not be a problem, is that the list is not static. I.e. it isn’t a snapshot of the files that were modified on that day - if you subsequently modify a file it’ll disappear from the list for that original day and move to the current day.

As I said, this may not actually be an issue depending on what your needs are, but it doesn’t ‘freeze’ the data. I’m not sure if there’s any way of doing that and I’m pretty sure the old dataview method had the same ‘issue’.

2 Likes

That’s what we get using ctime and mtime; and throw syncing into the mix, things can get really off depending on the situation.

The only way to be 100% sure (and “freeze” the data) is to write the date into the file YAML/Properties itself and query those values. e.g.

---
dateCreated: 2025-03-19
dateModified: 2025-06-03
---
2 Likes

Good content, must like!