Same here. Have you come up with some solution in obsidian?
I suppose it’s nearing time for me to make a plugin. I’ve had a couple people ask. At the moment, I’m using Templater’s JavaScript feature with Moment.js to keep track of time. I wear a stop watch to track the duration and Javascript can make some assumptions using it.
P.S.
I keep my time tracking in my daily notes, but would you have it any other way?
How do you do that?
I found the super simple time tracker plugin also uses moment.js. To me, this seems lika a good approach, but for me, the plugin is too simple. For example, I would like to be able to edit start and end time of each session, but more importantly, I’d want to be able to calculate the total time spent on one timer but also across timers.
Basically, my idea would be that each note can have one ore more timers attached to it and then I’d be able to query a set of notes in dataview and have the tracked time of all of these notes added up.
My spontaneous idea would be to extend the super simple time tracker plugin into a simple time tracker plugin by modifying it so that total time for each tracker is written into the note’s metadata as totaltime::
or something, so that it becomes queryable.
Another important feature for me would be that the time spent on subtasks (=a note) is automatically added to the task (=another note). For that, notes would have to be put in a hierarchical relation to each other. This can be done using the Excalibrain plugin.
A slightly different approach to task hierarchies without Excalibrain would be to use the hierarchy of headings to represent the task hierarchy, i.e. timers in lower level headings get added to the timers of higher level tasks. The advantage would be to not be dependent on another plugin but the downside is that the time tracking plugin would have to do all the summing within the note because (I believe) the dataview plugin cannot do that. Another downside would be that it becomes somewhat more difficult to move subtasks from one task to another because one has to move part of the actual content of the note to a different note. (To me, this is not trivial, because I want to be able to quickly start a new note/task and track time against it without having to thing about which parent task/project it belongs to. That would be determined later.)
Unfortunately, I am not able to write such a plugin.
It’s probably very similar to how that plugin creates its timestamps. It’s really just JavaScript and a grade-school level of math. Quite boring really
Sure, I see no reason you couldn’t get most of that to work with the right tools.
I suppose in the coming week I’ll release a plugin that lets you track time in your format of choice. It’s not everything, but it’s a start. I’ll keep you posted.
That’s cool. I’m very curious to see what you come up with.
Since I wrote my last post yesterday, I have started looking into tasks plugin and realized that it uses a different logic that what my spontaneous for time tracking implied. It that plugin, a task is not a note but a line/block (in fact, I couldn’t find a way of automatically linking a note to the task (except, of course, by manually adding a link to the task’s line). But this can probably be automated with quick add or so.
So, what I’m wondering is wether my idea to track time against a note (which, in my mind, would correspond to a task) actually is a good idea, given that a task in the core task plugin is at a different level. My hunch is that it is still a good way forward because if a task is big enough to create a separate timer for it, it seems okay to create a note for it (and link to it from the task block). In that note, there can then be more tasks which can either have their own note and timer, or they can be treated more like a check list that I work through, while the timer for the parent task is running.
I also noticed that the Project plugin also uses notes for tasks (i.e. anything below the project level), so that fits nicely. It allows you to specify a template for each task so you can just include the code block for the time in that template.
But I don’t think the time-tracking plugin would need to be tied to the Projects plugin, i.e. I don’t think it should use the project - task hierarchy when adding up the times from notes lower down on the hierarchy. I ementioned Excalibrain as a way of mapping hierarchical relationships but it just occurred to me that we don’t even need Excalibrain. We can just use nested tags. I think that would be the most robust implementation for the task-hierarchy.
So, basically, in any note with a timer, you’d specify which level of the task hierarchy that note belongs to and then it would be very easy (and flexible) to use dataview to create a report for whichever level you want. In other words: it would be completely irrelevant where in your vault the note is (or whether or not it is mapped onto a project in the project plugin. The only thing that determines how the time tracked in this note is treated are the tags, e.g. #project1/sub-projectX/task-A/sub-task9…
I had intended on getting back with you sooner, but I suppose the holiday season got the best of me.
I’m a little behind on my Obsidian tooling, so I’m just now getting my first plugin, Obsidian Plugin Manager, finished.
I should be able to publish a cleaned up variant of my time tracking script next week. We’ll see how I end up with the plugin.
I appreciate your time. Have a good day.