What I’m trying to do
Hello, I’m new to Obsidian and I’m working on building my first Daily Notes template. I’m trying to gather data from tagged list items and add up the Duration values to track how much I’ve spent on each task over the week.
Things I have tried
I’m encountering some issues with dataviewjs that I can’t find any references for.
When gathering data from different files, the Duration field seems to be malformed when I try to access it through object.file.lists.
Sample Data:
- [Subject::Math] [Title::Math Book 1] [Value::5] [Duration::01h02m] [Date::2023-09-01] #math #math/geometry
- [Subject::Programming] [Title::Learncpp.com] [Value::3] [Duration:: 45m] [Date::2023-09-01] #programming #programming/cpp
- [Subject::Programming] [Title::Accelerated C++] [Value::2] [Duration::02h10m] [Date::2023-09-01] #programming #programming/cpp
- [Subject::Reading] [Title::Test Book] [Value::2] [Duration::50m] [Date::2023-09-01] #reading #reading/literature
Sample Code:
let note = dv.pages('"Daily Notes/2023-09-01"'); // Grab values from a different file.
console.log(note); // Parent object contains properly formed Duration array
console.log(note.file.lists); // All list items have malformed Duration properties
Dev console
Screenshot 1
It seems to get worse when I query multiple pages (e.g.: dv.pages('"Daily Notes"');
instead of Daily Notes/2023-09-01
). The last weird behavior I’ve observed (but can’t manually replicate), is that the value of the malformed Duration changes over time. As I enter and exit the reading view, or click out of the note and back, all of a sudden I’ve studied years in a single day.
Should I not be relying on the parsed values of note.file.lists
? Are there other approaches to structuring my data I should be considering over my approach?
Thank you in advance!