I am trying to create a DailyNote when I click on a link to a date that doesn’t yet have a DailyNote. I am creating the Daily Note in a different template (for reasons that I’m pretty sure are irrelevant here) and then moving it into the appropriate directory. However, the addition of the new note isn’t reflected in Calendar until I re-start Obsidian. I can live with this if I have to, but it would be great to have these noted appear in the Calendar as soon as they are added.
Things I have tried
Aside from searching in vain for a solution, I’ve not tried anything.
DOn’t know if this helps, but I’ve learned that the new note will appear in Calendar so long as it’s full path is in the link that spawns it (e.g., [[Day/2024/10/2024-10-27]]). But if the link is [[2024-10-27]] and I move it to the correct location with javascript, it doesn’t appear in Calendar.
Hello,
To immediately ensure new DailyNotes appear in the Calendar, try setting the format to YYYY/YYYY-MM-DD and ensure the folder is correctly configured1. This should help the Calendar recognize new notes without needing to restart Obsidian. mcdvoice com
Thanks for the quick reply, Michael (and apologies for the delayed response). Unless there’s something magical about the date format you’ve proposed, I don’t think this will solve my problem. At present, my date format in the DailyNotes plugin is YYYY/YYYY-MM/YYYY-MM-DD/YYYY-MM-DD. When I create the new notes using Templater, I use tp.file.move to put them in the location corresponding to that date format. After doing so, they are visible in File Explorer but, as noted previously, they don’t appear in the Calendar until I re-start Obsidian.
If I’ve misunderstood your suggestion, please let me know.
The way I see this is that either you need to create the note in the correct folder immediately, which would trigger a create event which I reckon is what the Calendar is looking at.
Or you need to somehow trigger a rebuild/refresh of Calendar after you’ve moved the file into the correct location. I’m not sure how to do the latter as you might want to trigger a rebuild of the view where the calendar is displayed. Have you looked if there is an API for Calendar where you might force it update?
Regarding the first, it might be possible to instead of moving the file to the correct location you make Templater create the file in the correct location, and just return nothing (or a link) from the file where you initiated the creation of the note.
Thanks for your suggestions, holroy. Fortunately, I don;t have to deal with this very often since I susually add daily notes via the calendar. But when the situation does arise, it’s because I’ve manually added a date link in a note (e.g., [[2024-11-11]]) and, when I eventually click on it, Obsidian creates the file in the root directory, which means I need to manually put it where it belongs. Yes, I could avoid this by typing the full destination at the time I create the link, but that’s too onerous given the date format I’m using (i.e., YYYY/YYYY-MM/YYYY-MM-DD/YYYY-MM-DD).
In light of the above, I agree that the solution may lie with an API trigger. But this is where my expertise and knowledge of Obsidian comes up short. In brief, I’ve not yet found a way to do this.
I just scanned the github page, and I see they mention a command Calendar: Reveal open note. You could try running that command in your newly open note from the Command palette, or potentially from within the Templater template. It seems like that could reveal the note within the calendar.
Another option could also be to do a Force reload, to avoid fully restarting Obsidian.