franciskafieh / obsidian-list-modified

🪨 The advanced and adaptive changelog for Obsidian. Links all modified files meeting certain criteria to a timed (daily, weekly, monthly) note.
MIT License
85 stars 7 forks source link

[BUG] First record of the day is handled incorrectly (Create, Delete) #94

Open cotneit opened 2 months ago

cotneit commented 2 months ago

First Steps

Describe the bug

If creating a new note triggers "new day" flow in OLM, that note gets marked as Modified instead of Created.

UPD: Deleting is affected too. Looks like it writes deleted record into "yesterdays" data, writes that data to todays note and then clears "yesterdays" data, so any consequent change wipes it from daily note.

Rename fails with error in console if renamed note was not previously recorded today. Thinking about it, it doesn't really affect anything, though a check to avoid the error wouldn't hurt. But that's unrelated to this issue.

Expected behaviour

New note should be marked as Created.

Reproducing

My setup

Steps to reproduce bug

  1. Enable "Separate Created Files" (and Verbose Mode, it was super useful for debugging this)
  2. Wait for a new day to start (or disable OLM, change lastTrackedDate in data.json to previous day, enable OLM)
  3. Create new note
  4. Watch it get put under Modified heading instead of Created

Additional info?