xyhp915 / logseq-journals-calendar

A journals calendar for Logseq.
MIT License
150 stars 11 forks source link

Clicking on a future date doesn't create a journal entry correctly #5

Open jonahgoldsaito opened 2 years ago

jonahgoldsaito commented 2 years ago

First off, awesome. Thanks for making this plugin!

Yesterday I wanted to create a journal entry for today, i.e. one day in advance. An attempt at planning / structuring my day. Today the app opened with an empty journal page for the day, and today's journal page was empty.

// This is page data for the page I made in advance via the journal calendar plugin simply by clicking on a date in the future and editing the resulting page:

{:db/id 252,
 :block/created-at 1635216741402,
 :block/file {:db/id 254},
 :block/name "2021-10-26",
 :block/original-name "2021-10-26",
 :block/unordered true,
 :block/updated-at 1635253224523,
 :block/uuid #uuid "61776d63-0a91-451a-a185-4ea1471429a0"}
// The data for today's empty auto-created journal page when I launched the app
// Clearly a different page, but also a very different format

{:db/id 259,
 :block/format :markdown,
 :block/journal-day 20211026,
 :block/journal? true,
 :block/name "oct 26th, 2021",
 :block/original-name "Oct 26th, 2021",
 :block/uuid #uuid "61777d42-13a9-406c-840e-89dfc49aba34"}
// When I try creating a test of a page for tomorrow via logseq's /date date picker component, the format appears to be the same as the auto-generated. I assume it will work as intended.

{:db/id 268,
 :block/journal-day 20211027,
 :block/journal? true,
 :block/name "oct 27th, 2021",
 :block/original-name "Oct 27th, 2021",
 :block/uuid #uuid "6177ff89-c64d-4ac3-af6f-b0f37c72f12c"}

Is there a reason the calendar plugin doesn't use a different format? Would love it to work as expected :)

jonahgoldsaito commented 2 years ago

I'm new to logseq and it's API, but I just noticed what I assume is the conditional determining if a calendar date click corresponds to a journal page here:

if (this.journals.hasOwnProperty(k)) {
        id = this.journals[k][`original-name`]
      } else if (this.preferredDateFormat) {
        // TODO: user preferred date format?
        // const format = this.preferredDateFormat.replace('yyyy', 'YYYY').
        //   replace('dd', 'DD').
        //   replace('EEEE', 'dddd').
        //   replace('EEE', 'ddd').
        //   replace('EE', 'dd').
        //   replace('E', 'dd')
        // t = dayjs(id).format(format)
      }

      logseq.hideMainUI()
      logseq.App.pushState('page', { name: id })

I haven't change my date format, so the name of the new page is as expected, but the system is still creating it as a generic page. Is there more meta data that needs to be passed, perhaps through that JS obj that now only contains a name property? I can't seem to find any info on that API call anywhere. If I could, I would have tried to fix it already :)

Thanks!

jonahgoldsaito commented 2 years ago

Another two symptoms (I assume).

  1. I tried deleting the page created yesterday by the calendar plugin via its page's title dropdown. The calendar plugin still doesn't link to today's auto-created journal entry. It's instead creating a whole new page (id 275).

  2. The orange "today" indicator remains on yesterday. Attaching a screenshot showing the calendar displaying Oct 25, overlaid on today's auto generated journal entry of Oct 26th.

    Screen Shot 2021-10-26 at 9 53 27 AM

Could the creation of a page with the incorrect format have thrown everything off? I'm curious if it will still be the 25th tomorrow :)

MelBourbon commented 2 years ago

With current Logseq 0.7.1 using the plugin also creates the date file not in the journal folder. It creates instead a file in the pages folder. With this the new created files are not part of the journal.

kweiberth commented 1 year ago

Was this a conscious decision that this plugin would no longer create journal entries? Or was it a breaking change in Logseq, and this plugin has yet to be updated?

Robinlovelace commented 1 year ago

Woa this sounds like a major bug. I'm thinking about installing the plugin but not sure it's ready after reading this. Did you get it working on recent versions @jonahgoldsaito and please give us an update @xyhp915 if you get a chance.

Many thanks for an amazing plugin, look forward to testing it!

xyhp915 commented 1 year ago

Hi @Robinlovelace I tested with the latest version (0.7.8). And it works fine?

https://user-images.githubusercontent.com/1779837/180190318-b1fc42df-c9ef-4504-b77c-9391e2dcdf7a.mp4

kweiberth commented 1 year ago

Works for me now as well w/ version 0.7.8.

MelBourbon commented 1 year ago

Still not working for me in 0.7.8 ... Maybe related to date format used. If I create a page with the plugin for next Tuesday for example it creates the file with Tu, 26-07-2022. image

But my time format is set to:

image

And there normally Tue, 27-07-2022 is required. Therefore this is a normal page only and not stored in journals folder

JRSerjeant commented 1 year ago

stalling the plugin but not sure it's ready after reading this. D

I have this same issue. Does this problem present if you have a custom date format in config.edn > :journal/page-title-format "E dd MMMM yyyy"

Not had a chance to test this yet/

artjomsR commented 4 months ago

I can create an entry via the calendar, but the same calendar won't show that a day has any entries there. Refreshing and re-indexing doesn't help - only after logseq restart the day is correctly populated in the calendar plugin. See video demonstration.

This doesn't happen if I go to the entry via logseq natively (e.g. by using Go to previous/next journal / Go to tomorrow shortcuts) - in this case the calendar plugin can see them straight away, without needing a logseq restart.

My system specs

https://github.com/xyhp915/logseq-journals-calendar/assets/6875790/17fba698-6b3d-4ade-99f2-ed1b27d2d5d8

image