Bases: ISO Week functions

Use case or problem

I am loving Bases so far, and I have mostly been able to replace my (few, sparing) uses of DataView with it.

One thing I like to do is have a Weekly Note and have links to all the Daily Notes from that week. This is fairly easy to achieve with:

```dataview
LIST ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"][file.day.weekday - 1]
FROM "Daily Notes"
WHERE file.day.weekyear = this.week AND file.day.year = this.year
SORT file.day
```

Likewise, I have a DataView query in each Daily Note that creates a link back to the respective Weekly Note.

Proposed solution

These would be easy to do in Bases if Date objects had a week() method to access the ISO week number.

Current workaround (optional)

I guess you’d have to do some arithmetic yourself based on the difference in days, but that would require manually adding the date of the first day of the week to the properties of the weekly note, which would be tedious.

Related feature requests (optional)

Adate.weekday() method would probably also be useful to many people, though I don’t know if anyone has already requested that.

2 Likes

As a workaround (?), you could try to format a date using format() (which uses MomentJS tokens) :blush: .
You’ll get a string as a result though but you could coerce it into a number if/when needed…

E.g.: Using the file.ctime of notes created today (2025-08-19) and formatting it as "WW" (for the ISO Week number), I get 34

1 Like

I have a very similar query. Enjoyed playing with Bases today and can already see the enormous potential. Just amazed at the speed!

I am looking for replicate a Dateview formula I have, which shows me files created within the past 8 hours (a working day.)
Currently using this:

TABLE dateformat(file.ctime, "HH:mm") as Time
FROM ""
WHERE date(now) - file.ctime <= dur(12 hours)
SORT file.ctime desc

But cannot quite get there in Bases. Missing something very simple I think.

This is off-topic when it comes to the feature request (:sweat_smile: ) but you can use an Advanced filter (by clicking on the </> icon next to the trash can, in the filter GUI), stating something like:

now() - file.ctime <= '12h'

For the “Time” column, you could use, as a formula:

file.ctime.format("HH:mm")

or just

file.ctime.time()

… potentially :blush:

Appreciate the response, and it works perfectly! Thank you so much. Apologies for the off-topic (never browse the forum on your phone!)

1 Like

I was searching for a solution when I encountered this topic. As it wasn’t obvious to me, I hope this helps others.

Thanks to Pch’s suggestion using format() I was able to pull together a filter:

file.ctime.format(“gggg-[W]ww”).contains(this.file.name)

This shows all the notes created in the week, provided that the weekly note is named gggg-[W]ww