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

Allow completion tracking to stamp the task with link to daily note instead of just date

Open mt-krainski opened this issue 3 years ago • 2 comments
trafficstars

Context

I'm just starting with dataview for task management and I must say I love the flexibility! The task completion tracking feature is really useful. It appends e.g. [completion:: 2022-07-07] to a task which was marked as done in the dataview query result, which in itself is a great feature. And I like that one can customise the label of the metadata (e.g. use done instead of completion).

What I'd like

I am using daily notes to track my day-to-day activities and I'd like to be able to retain the link between the task completed on a given day and the note for that day. I.e. I'd like to be able to be able to set up the plugin to output the metadata field as [completion:: [[2022-07-07]]]. This way the metadata field links the task to the daily note in an Obsidian-y way.

For writing down due dates and other dates in the metadata I'm mostly using the Natural Language Dates plugin which I have set up to output links to daily notes and not just dates. If I could have the same format in all date fields it'd just be nice.

Alternatives

I still can write the query for a given daily note to display all tasks completed on that day, so perhaps this is not the most relevant feature request.

Other notes

I'm a dev, I know a bit of typescript and javascript. If you like this feature idea, and you'd like to point me more or less where I should make the changes, I can possibly prepare the merge request myself for this.

mt-krainski avatar Jul 08 '22 02:07 mt-krainski

I think the easiest way to accomodate a variety of ideas here is to just do some date formatting - just add a dataview setting which lets you write what you want the field to be (like [[YYYY-mm-dd]] or something).

If you'd like to take a stab at a contribution, you can add a new setting for "completion format" by:

  • Adding the setting to settings in settings.ts.
  • Add it to the settings tab in main.ts in "GeneralSettings" (just copy another text input field like the date format field setting).
  • In task-view.tsx, which actually sets the completion text when you check the box, format the datetime (using the luxon toFormat function) and use that as the completion value instead of whatever we do currently.

blacksmithgu avatar Jul 08 '22 06:07 blacksmithgu

Thanks @blacksmithgu, I'll try to write this during the week. I'll let you know if I have more questions!

mt-krainski avatar Jul 10 '22 23:07 mt-krainski

When a task use timestamp with link (e.g. [completion:: [[2022-12-01]]] or [due:: [[2022-11-30]]), how can I query these tasks with date() function?

I tried the following conditions are not working:

  • TASK ... WHERE due <= date("2022-12-01")
  • TASK ... WHERE due <= date([[2022-12-01]])
  • TASK ... WHERE due <= date("[[2022-12-01]]")

Markdown Sample

---
tags:
  - "query-date-with-link-demo"
---

## Tasks

- [ ] First Task [due:: [[2022-12-01]]]
- [ ] Second Task [due:: [[2022-12-05]]]

## Dataview Query

Note: `WHERE due <= date("[[2022-12-01]]")` not works.

```dataview
TASK
FROM #query-date-with-link-demo
WHERE due <= date("[[2022-12-01]]")
```

Dataview Query Result

2022-12-01-163859-Obsidian


edentsai avatar Dec 01 '22 08:12 edentsai

Could you kindly open a discussion and put this question there instead? Happy to assist after you make the change.

AB1908 avatar Dec 01 '22 10:12 AB1908

I opened a discussion here: How to query tasks by due date with internal link format?

edentsai avatar Dec 01 '22 17:12 edentsai

The original issue has been addressed so I'm happy to close this thread. Thanks @blacksmithgu for helping!

mt-krainski avatar Mar 09 '23 14:03 mt-krainski