Steps to reproduce
- Configure the daily note date format to “YYYY/MM/YYYY-MM-DD \C\A\L\L”, and no parent folder, but set a “Folder path to create new notes in” of “Inbox”
- Create a 2021/01 folder in the vault root, and an Inbox folder. Create a note “2021/01/2021-01-14 CALL”, and close it.
- Invoke the “open today’s note” command.
Today’s note should open.
Nothing happens. Checking the developer console, the following error appears:
Uncaught (in promise) Error: ENOENT: no such file or directory, open 'E:\Daybook\Inbox\2021\01\2021-01-14 CALL.md'
In this case “Inbox” is the “Folder path to create new notes in”, which should not be being prefixed to the daily notes path. I tried changing the daily notes format to use an absolute path (i.e. prefixing it with
/), and got a different error:
Uncaught (in promise) Error: File already exists.
The only way to stop the prefixing appears to be to turn off the “create new notes” path.
- Operating system: Windows
- Obsidian version: 0.10.7
What appears to be happening in the second case (
/-prefixed date format) is that the daily notes plugin is now not recognizing the file doesn’t exist (after checking under
Inbox), then tries to create it at the correct path, which then fails because it already exists. The approach it uses to check for the file’s existence seems to be based on non-/ prefixed paths (the cache doesn’t normalize paths on checking for existence).
The workaround for this seems to be to empty the setting for “Folder path to create new notes in”.
Earlier versions of Obsidian handled this configuration fine (as long as the note’s parent folder existed), but I think this might actually have stopped working as of 0.10.6. I’m not positive when it stopped because I use the Calendar plugin (which has no problem with this filename format). I’m fairly sure that one of the 0.10.x series quit creating the daily notes if they didn’t exist, but earlier Obsidians did create them, and I’m pretty sure Obsidian was opening for most of this year. So I would guess that opening them broke as a result of a bug fix to something else, perhaps in 0.10.7.
While investigating this problem, I also discovered that Obsidian has previous and next daily note commands… which I never knew existed before because they don’t work with my date format. Apprently the
iterateDailyNotes() method compares the basename of the file against the full format string, instead of e.g. taking the basename of both, and then regenerating the target path from the parsed date and seeing if it’s a suffix of the full path.)
The format string I’m using, by the way, is not one I reallly want to change at the moment, as I have many years of pre-Obsidian notes in this organization. It seems the Calendar plugin has no problems because it doesn’t ever try to parse file names, it just generates them from a set of dates.
One possible way to improve the detection/iteration behavior (besides taking the basename of the format and checking the suffix), would be to convert the format string + base folder to a regular expression, saved with the plugin settings. It then would be very fast to find/iterate daily notes by testing them with a regex before attempting date parsing, and it’d make having a daily notes search option practical.
But just using the basename of the format string would certainly work for my format, or better yet, just don’t take basename of either part, just remove the notes folder prefix from the file’s full path. That would also avoid problems when people have a date format that doesn’t include the full date in the basename, as I do.