Closed derekvan closed 1 month ago
Could you tell me whether you use default daily note plugin or periodic notes plugin? And could you show me your daily note title format, like YYYY-MM-DD ?
I'm using the core Daily notes plugin, as well as the Calendar plugin (but not periodic notes). And the title format is YYYY-MM-DD
thanks for information, I will look into this. Btw, how many daily notes do you have?
Maybe around 450
On Tue, Nov 15, 2022 at 7:38 AM Boninall @.***> wrote:
thanks for information, I will look into this. Btw, how many daily notes do you have?
— Reply to this email directly, view it on GitHub https://github.com/Quorafind/Obsidian-Daily-Notes-Editor/issues/17#issuecomment-1315253040, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGZLZK4BVCPH3DPKUE3OJDWIN72VANCNFSM6AAAAAASAJHYPQ . You are receiving this because you authored the thread.Message ID: @.***>
Same here - it's not rendering in any particular order for me. They are rendering, just in a random order.
I'm using periodic notes and my date format is also "YYYY-MM-DD". Here are the first five notes in order in case that helps: 2022-09-20 2022-11-29 2022-11-10 2022-12-01 2022-11-26
I have 76 daily notes, FWIW
BTW, thank you so much for making this!!!!!!! I love Obsidian but this was one of the features I missed from Roam
Hi, same issue here in Obsidian 1.1.6. I'm also using YYYY-MM-DD as the format for my daily notes, thanks in advance
i'm seeing the same issue but using YYYYMMDD as the format for my daily notes.
I'm seeing the same issue currently. Daily notes are named YYYY-MM-DD
but title is # {{DATE:dddd Do MMMM YYYY}}
(ie whats the H1
in the file) if that matters.
I've noticed mine become out of order if I delete one from two days ago then recreate it. For some reason it ends up above ones from a later date.
I'm on Obsidian 1.1.6 if that helps. I use the Periodic Notes plugin, not the default Daily Notes plugin.
I'm having the same issue where the sort order seems to be random. Sometimes it changes to show different notes at the top. I notice this especially on the Obsidian mobile app for iOS and iPadOS, but it's also happening on the desktop app.
YYYY-MM-DD
One other thing to note is that my daily notes are broken down into subfolders by year and month:
One reason these go so far back is because I've ported journal entries from other systems into Obsidian, so some of the older entries have newer file creation dates. I'm not sure whether this make a difference, but figured I'd mention it.
I have the same issue. Really nice plugin, but with a random order, it's pretty useless unfortunately 😔
I also tried to look at the code, but couldn't find the part where the notes are read from the folders. Thought it shouldn't be too hard to fix, that the notes are ordered by filename. Unfortunately I was wrong 😅
This bug remains unfixed. It's a real pity, as it effectively renders this otherwise very useful plugin unusable. Are there any plans to fix it?
Can confirm, suffer from the bug as well. Up to date Obsidian, YYYY-MM-DD Daily Note format.
Probably this is a bug from obsidian api. I cannot sure. But could be fixed by adding sort function like this
$: if(hasMore && !hasFetch) {
cacheDailyNotes = getAllDailyNotes();
for (const string in cacheDailyNotes) {
allDailyNotes.push(<TFile>cacheDailyNotes[string]);
}
// @ts-ignore
allDailyNotes.sort((a, b) => {
if (a.name == b.name) return 0;
else if (a.name > b.name) return -1;
else if (a.name < b.name) return 1;
})
hasFetch = true;
checkDailyNote();
}
@happytk yeah thanks it should be something as simple as that. does this exact code work?
Probably this is a bug from obsidian api. I cannot sure. But could be fixed by adding sort function like this
$: if(hasMore && !hasFetch) { cacheDailyNotes = getAllDailyNotes(); for (const string in cacheDailyNotes) { allDailyNotes.push(<TFile>cacheDailyNotes[string]); } // @ts-ignore allDailyNotes.sort((a, b) => { if (a.name == b.name) return 0; else if (a.name > b.name) return -1; else if (a.name < b.name) return 1; }) hasFetch = true; checkDailyNote(); }
Unfortunately implementing this didn't do anything for me. The plugin is exactly what I wanted but like others have mentioned it becomes useless if it isn't able to sort the daily notes properly.
This is the only plugin that has come remotely close to the functionality I have been looking for.
same problem.
it worked fine at first, when I have 10+ daily notes. but after I migrate logseq daily notes to obsidian, notes number increase to 250, the notes order was wrong. then I restart obsidian, the order seems to be right again.
Using periodic notes with 88 daily note files, this plugin is showing my notes out of order.
I tried @happytk's solution and it does in fact work for me. @razinm is it possible something went wrong so you might not have actually been testing the modified code?
It looks like cacheDailyNotes
returned from the API is a Record<string,TFile>
. I am not a TypeScript or JavaScript expert but I'm guessing this is analogous to record/map types in other languages where there's no guarantee on ordering of elements, i.e., the order of iteration might depend on system implementation details? That would imply that we need an explicit sort if we do want to guarantee an ordered array of notes (allDailyNotes
). It looks like the string
keys are date representations of the form day-2024-04-06T00:00:00-07:00
so it's sufficient to just sort them in descending order.
I think it's slightly cleaner to do this as the list is constructed (vs after the fact as in @happytk 's solution):
$: if (hasMore && !hasFetch) {
cacheDailyNotes = getAllDailyNotes();
// Build notes list by date in descending order.
for (const string of Object.keys(cacheDailyNotes).sort().reverse()) {
allDailyNotes.push(<TFile>cacheDailyNotes[string]);
}
hasFetch = true;
checkDailyNote();
}
but the result should be equivalent in either case. I've created a PR implementing this solution. Comments welcome from anyone who actually knows anything about JavaScript and/or Obsidian plugin development. :-)
@davmre It is very possible that something might have gone wrong. I am not a dev at all and i had to figure out on my own how to compile it after adding happytks suggestions. 🤣
Well, struggling similarly now, i get a build error, i had forgrotten what i had done to fix it 😅
Please try again and see if this issue remains.
Please try again and see if this issue remains.
The order is fine now with the latest version!
Bug Description
Can you make the files sort in chronological order? Mine seem to be sorted in a random order.
Relevant Screenshot
No response
To Reproduce
No response
Obsidian Version
1.0.3
Which editor are you using?
Checklist