obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Bug report

Open irodionzaytsev opened this issue 5 months ago • 0 comments

What happened?

DateTime documentation - I cannot convert it to string and compare to today. In debugger console I understand that I have a DateTime variable, but I cannot find its documentation and understand how to exctract the date from it (i want to display tasks completed today. I can't convert them to ISO string.

DQL

// Get today's date in the format YYYY-MM-DD
const today = new Date().toISOString().split("T")[0];
// Initialize a counter for tasks completed today
let completedTaskCount = 0;


// Loop through all tasks in your vault
dv.pages().file.tasks.where(t => 
t.completed)
.forEach(t => {completedTaskCount++;
    console.log(t.completion.toISOString());});

// Output the count of tasks completed today
dv.paragraph(`**Tasks completed today:** ${completedTaskCount}`);

JS

No response

Dataview Version

latest

Obsidian Version

latest

OS

Linux

irodionzaytsev avatar Sep 10 '24 09:09 irodionzaytsev