Skip to content

How to query for month overview? #1185

Closed Answered by StartAGarden
StartAGarden asked this question in Q&A
Discussion options

You must be logged in to vote

I managed to make it work with DavaviewJS and I wanted to share it with anyone who might be struggling with the same problem.
Code is not tested extensively but should work. Feel free to correct me if I am wrong.

```dataviewjs
const currentDate = new Date();
const currentMonth = currentDate.getMonth();
const currentYear = currentDate.getFullYear();

const lastDayOfLastMonth = new Date(currentYear, currentMonth, 0);
const firstDayOfNextMonth = new Date(currentYear, currentMonth + 1, 1);

const query = `
not done
due after ${lastDayOfLastMonth}
due before ${firstDayOfNextMonth}

# You can add more task instruction here like:
hide due date
`;

dv.paragraph('```tasks\n' + query + '\n```');

Do…

Replies: 6 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@claremacrae
Comment options

@claremacrae
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@claremacrae
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@claremacrae
Comment options

@claremacrae
Comment options

@claremacrae
Comment options

Answer selected by StartAGarden
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
scope: documentation Improvements or additions to documentation status: released Done, and included in a public release scope: filters Additions and modifications to the search filters
3 participants