Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do tasks with custom states and due dates work? #807

Open
blandir opened this issue Mar 13, 2024 · 1 comment
Open

How do tasks with custom states and due dates work? #807

blandir opened this issue Mar 13, 2024 · 1 comment

Comments

@blandir
Copy link

blandir commented Mar 13, 2024

I'm trying to use tasks with custom states and set a due date. However, I cannot figure out what I have to do. I found https://silverbullet.md/Plugs/Tasks but there is no information where to configure the possible task states or how to insert the due date. There is no hint on the SETTINGS page as well.

Could somebody please tell me, where I can find such information?

@simone-viozzi
Copy link

I can't help with custom states, but I'm curious.

For Due Dates: To add a due date to a task, you can either use the attributes syntax or an emoji date format.

  1. Using Attributes Syntax: [due: YYYY-MM-DD]

    - [ ] Submit the final report [due: 2024-03-21]

    example queries:

    task where due = "2024-02-29"
    
    task where due <= "2024-02-29"
    
    task where due = null
    
  2. Using Emoji Dates: For a more visual method, include a calendar emoji followed by the date.

    - [ ] Review project milestones 📅 2024-02-29

    example queries:

    task where deadline = "2024-02-29"
    
    task where deadline <= "2024-02-29"
    
    task where deadline = null
    

To simplify the writing of due dates, I also created templates for due today, due tomorrow, due next week etc...

Due today template:

---
tags: template
description: "Due today"
hooks.snippet.slashCommand: dueToday
---
[due: {{today}}]

Due next week template

---
tags: template
description: "Due in a week"
hooks.snippet.slashCommand: dueWeek
---
[due: {{dateAdd(today, 7, "days")}}]

this required the creation of a space script to add the dateAdd function:

silverbullet.registerFunction("dateAdd", (baseDate, daysToAdd) => {
  const parsedBaseDate = Temporal.PlainDate.from(baseDate);
  const resultDate = parsedBaseDate.add({ days: daysToAdd });
  return resultDate.toString();
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants