lumoe / obsidian-rollover-daily-todos

An obsidian plugin that rolls over todo items from the previous daily note
MIT License
247 stars 60 forks source link

fix/rollover-not-working: Don't compare with slash at the end #96

Closed tim-hilt closed 1 year ago

tim-hilt commented 1 year ago

Fixes #94

lumoe commented 1 year ago

Hey, I believe the root cause here is that Obsidian allows multiple definitions of the pathPrefix for daily notes. To tackle this, we have to think about the path to a daily file, which consists of two components:

Edit: pathPrefix is the Note Folder setting and the second part of the path is the Format setting

This gives us three options we need to cover:

  1. pathPrefix/ + 2022/Feb/01.md
  2. pathPrefix + 2022/Feb/01.md
  3. /pathPrefix/ + 2022/Feb/01.md

In order to get the moment timestamp from the path, we have to remove the pathPrefix from the complete path and cover all three cases, since they're all valid settings in Obsidian.

I reckon that's also why this sort of issue surfaces once we address it for one of the other cases. What do you think about this? Am I missing something?

tim-hilt commented 1 year ago

Now that I think of those issues again, I think the discussion should actually be a different one: path-handling is becoming too confusing. We should refactor the settings-parsing, so that we can rely on the daily-notes-path being of the form path/to/ with a slash at the end.

this way we don’t have to parse the notes-path when the rollover-function runs. Paths will be handled the same way everytime then.

lumoe commented 1 year ago

Sorry for taking so long. I ran some tests locally and it still works as expected :+1:

Going to implement the path handling you proposed, in v2, in the summer when there is more time available.