Issue with Setting Time Interval in Table Code in Obsidian Dataview Plugin

Hello!
I need help!
I need to add code to the table with a specified time range, so that the table displays data for a certain period, for example, from 2023-02-14 to 2023-05-15.

Here is the code:

TABLE WITHOUT ID
	date AS "date"
	title AS "title"    
FROM #bookinfo 
SORT date

---
title:
date: 2023-02-14T06:00:00+06:00
tags:
 - bookinfo 
---

This code doesn’t handle the time range correctly.

TABLE WITHOUT ID
	date AS "date"
	title AS "title"    
FROM #bookinfo 
WHERE date > date(2023-01-01)
SORT date

You’re not supposed to post duplicate threads on the same subject, and you need to remember that most (if not all) of those responding in the forum volunteer doing so. This means it can take time between responses, and bumping threads is usually not the way to go.

What doesn’t work in your current example? It works straight out of the box as written for me. Be aware that if you compare against equal dates you might run into issues, especially when some of the dates are fully qualified as your example is.

@holroy
Sorry for duplicating questions.
I couldn’t delete the previous question as it wasn’t editable, so I had to create a new one.
This question differs from the previous one.

As a new user, I’m still trying to understand how things work on this forum, so I apologize for any confusion.

When using WHERE

date(2022-01-01) > date(2023-01-01) 

the plugin or code isn’t functioning correctly

How does that not work?

The table stops working, meaning it doesn’t output any data. The table is empty.

TABLE WITHOUT ID
	 link AS "link",
     photo_book AS "ph",
     photo_avtor AS "phh",
     avtor AS "Авторы",       
     property AS "prop",
     finish AS "finsh"       
FROM #bookinfo 
WHERE contains(avtor, "")
WHERE contains(property, "🏢")
WHERE contains(finish, "✅") 
WHERE date(2022-01-01) > date(2023-01-01)
SORT date

---
title:
avtor: 
redaktor:
perevod: 
date: 2023-02-14T06:00:00+06:00
date1: 2023-03-14
baspa: 
sity: 
sheet: 
property: 🏢
finish: ✅
proces_book: <p> <progress max=100 value=100> </progress> 100% </p>
star: 5
ISBN: 
date2: 1980
lang: 
nation: 
country: 
genre: 
tags:
  - bookinfo
  - Астрономия
  - вселенная
  - научно-популярная
updated: 2023-11-04T19:07:28+06:00
allname: 
---

And since when is a date in 2022 larger than a date in 2023?

Here’s the translation of the text:
"
When

WHERE date(2022-07-01) <= date(2023-01-01)

The table outputs:
from

---
date: 2022-04-28T06:00:00+06:00
---

to

---
date: 2023-11-20T23:05:41+06:00
---

This is incorrect, erroneous.

That statement will never change its value since it compares two fixed dates. If you want it to a test for a date range you need to compare it to something. So try the following instead:

WHERE file.day >= date(2022-07-01)
  AND file.day < date(2023-01-01)

This should give you the date range from (and including) 2022-07-10 up before 2023-01-01. In other words, the second half of 2022. (You might need to do striptime(file.day) instead of just file.day to get the matching correct for the dates at the end of the range.

1 Like

Hey Holroy,
Guess what? My spreadsheet is finally doing its thing! I’ve been stuck with this problem for a good two to three years. Recently, I reached out to a Russian-speaking audience (forum) for some help, but unfortunately, I didn’t get any responses. Maybe I didn’t quite word my questions correctly.

But hey, now I’m feeling ecstatic! Wishing you all the best in health and a long, fulfilling life, Holroy.

Sorry for doubling up on the forum question; I was really worried that I wouldn’t get a response to my query.

1 Like

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