Tasks plugin: how to INCLUDE or NOT INCLUDE any form of HH:mm (time) from task description?

Things I have tried

“description includes {{time}}” will only insert the time of the moment I generate the Daily Note, so that is pointless. Odd chance that any task would match that. Otherwise I wouldn’t know what try…

What I’m trying to do

Well, I am trying to tell the Tasks plugin, with its native query method, to INCLUDE or NOT INCLUDE all tasks that have the time in their description in the format of HH:mm (24 hr time, no am/pm times)

I keep my timed tasks in a separate note called Agenda. They are more like events, with a due date and a start time. Tasks plugin doesn’t have timed tasks (yet) as far as I know, so I put the HH:mm time in bold at the beginning of a timed task. Plain text of course since {{time}} gives you the time for the moment you create the actual task or note, and that’s not what I want. Since most of my timed tasks/events are in this specific note, and there are none in that note without a HH:mm in their description, I do not need to knowhow to query for the time bit in the description. So far so good.

I query those timed tasks/events in my Daily Note template like so:

due on {{date:YYYY-MM-DD}}
path includes 0. PLANNING/Agenda
sort by due
sort by description
hide due date
hide done date
hide task count
#hide edit button
short mode

which gives me the timed tasks/events for that specific Daily Note only.

But, I also want to see what timed tasks/events there might be in some other non-periodical note, say in some project note. Otherwise I would overlook those. To query those, I do need to know how to INCLUDE any HH:mm time string and I don’t know how to do that.

This is what I have now, but that obviously doesn’t work:

due on {{date:YYYY-MM-DD}}
path does not include 0. PLANNING/Agenda
description does include **{{some timestring}}**
sort by due
sort by description
hide due date
hide done date
hide task count
#hide edit button
short mode

Does anyone know how to EXCLUDE any form of HH:mm (time) from task description?

@schemar Martin, is this at all possible? It would make my planning with tasks so much more valuable if I can include/exclude tasks with a time.

Thanks in advance for thinking along!

I think @ClareMacrae is the primary maintainer now; it might also be worthwhile to post this in the Discussion Section on GitHub

1 Like

I use a tag #time and then a sl;ash and the time without the colon - #time/HHMM I add a “tags include #time” to the query and also have this ias the first tag after the #tasks tag and add a “sort by tag 1”.

i get all items that have a time that I care about and they are sorted by time.

1 Like

Good idea, I have also played with the idea of using a tag but I soooo hate that # hashtag symbol :joy: and I have given some thought to using a priority since I do not use those for anything specific. But that is actually not my point. I really want to know what query/string I should use to include or not include the time. If at all possible. That would be the cleanest option with the least steps.

I don’t think there is one you can use in the description field that would do this as it doesn’t take a regex or any special time recognition patterns for the match on that field.

For EXCLUDE I could imagine a rather ugly pile of description does not include queries that would probably be good enough to exclude times without excluding things like URLs. The following assumes that you might have tasks due at midnight, but otherwise don’t have any due at night. Edit as needed.

... (your other filters)
description does not include "00:"
description does not include "07:"
description does not include "08:"
description does not include "09:"
description does not include "10:"
description does not include "11:"
description does not include "12:"
description does not include "13:"
description does not include "14:"
description does not include "15:"
description does not include "16:"
description does not include "17:"
description does not include "18:"
description does not include "19:"
... (sort, hide, etc)

Edit to add: this does NOT work for the other way around since tasks filters work only like statements dataview can combine with AND. It has no equivalent for the dataview OR except making multiple separate tasks queries. I also very much echo @anon9387239871’s suggestion of posting to the Github Discussion page.

1 Like

I like the way your brain works, @scholarInTraining :grin: why didn’t I think of this! Thank you :kissing_heart: (again!)

I have been reading that discussion at Github. Didn’t realise that Clare is now (also) a/the maintainer of Tasks. I will add a comment to the discussion or the topic.

I just did a little google hunting for an applescript that would take a selected Obsidian task and turn it into an Apple Calendar event. And then use Text Expander or Shell Commands plugin to trigger that script somehow, preferably with a hotkey or a button or something. Because well, sometimes events are so important that you need to set an alarm that will sound where ever you are, even if not at your computer. But my iPhone will always remind me of my events.

There are scripts out there that do this, but I would have to look into those and learn applescript or at least learn to understand what it does. I’m not sure I can pull that off at my age with my alpha wired brain, haha but it sure sounds interesting.

Right now I am building a note that can serve as some sort of perpetuous calendar that you can just copy and paste for every new year. It is going to be one long note, with at the top links to all the months of je year, which are basically just sections below a #### header in the note. And then below say the June 2022 section, there will be line with links to every possible date in June like so: 01 | 02 | 03 etc and those numbers will be links to the actual part of the note that has room for the timed tasks/events of the corresponging date.

Setting it up like this will allow for fast entering a task at the right spot in this Calendarnote, that will be automatically linked to the top of every note through the NewNote template and every other Template that might need it. I keep a separate Menu note for that That right now only has 3 links: to the Home note, the Agenda note and the general ToDo note.

Once it is done, I will make a post here on the forum to share it, along with an explanation of how you might use it. I hope then people will come up with adaptations and ideas so we can all learn and benefit.

This for me feels like building a website and that is something I am way more comfortable with than javascript etc. But for the difficult parts that involve coding, there is the beautiful Obsidian community that I can ask for help :heart:

1 Like

All the code I have seen you make is far more elegant than my suggestion! For example, your solution for INCLUDE (which I still would have 0 ideas on how to solve in Tasks if you hadn’t solved it). I don’t know if that’s a practical consequence of what you describe as the “alpha-wiring” or your website experience, but I have been learning from reading your examples.

I know absolutely nothing about Apple systems or software but I had a somewhat website-related thought: sometimes websites or emails about events will have a link that says “add to your calendar”, right? Could you make such a link yourself? I assume the days and times are just in URL parameters of the link? Does such a link work on all the devices where you enter notes? (Step two would then be how to make that URL automatically from the contents of your task, maybe Text Expander or the documentation for AppleScript can help with that.) This might be a totally terrible idea, but it popped into my head so I thought I’d share.

Please!

Alas, @scholarInTraining … multiple “description includes” do not equal “AND”…it equals “nothing will show”. You can only enter one instance of “description includes”, so it seems. I tried several combinations. I had a task, due for today, with the time in the description being 13:57. I tried the following:

I didn’t use “description includes” at all → task shows up (as it should)
I used “description includes 13:” on its own → task shows up (as it should)
I used “description includes 12:” on its own → task does not show up (as it shouldn’t)
I used both “description includes 13:” AND “description includes 12:” → task does not show up - but we hoped and expected that it would, because you CAN use multiple instances of other Tasks-query bits such as tags, priority and hide.

Yes this only works to EXCLUDE. Multiple includes would be an OR not an AND to tie them together.

Does not include 12: AND does not include 11: are both true of 13:
You are exactly right that AND including two mutually exclusive things should give 0 reaults.

Would be easier if it were AND/OR :slight_smile:

Yes, I agree. Tasks just doesn’t have that feature yet. I know it has been requested! At least the constraint here is one that we can describe and think about with language, rather than a mystery in a pile of code. (I have been staring off and on at fullcalendar!)

1 Like

Me too (full calendar) ! But as long as it doesn’t have bi-directional syncing/editing, for iCloud Calendar and/or Google Calendar, I will use my self developed system of timed tasks etc just to get the magazine work done. I will be in Obsidian for most of that proces, apart from the real creation of the magazine in InDesign. But content gathering, how-to’s, planning, writing and dealing with my 2 workpartners, our authors, distributors, advertisers etc can all be done from Obsidian, I think. In combination with Gmail and maybe Slack. I may change this workflow in the future, as Full Calendar develops. It would be awesome if it had bi-direcional syncing. I would even pay a few dollars each month if that were possible. Or our foundation would, haha.

1 Like