benjypng / logseq-datenlp-plugin

MIT License
73 stars 5 forks source link

Not parsing dates "semi-automatically" #46

Closed meain closed 11 months ago

meain commented 11 months ago
dex-d4cc9a0b.js:58 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'parse')
    at Ga (index-d4cc9a0b.js:58:1310)
    at MutationObserver.IO (index-d4cc9a0b.js:62:333)

Probably coming from nothing being available here: https://github.com/hkgnp/logseq-datenlp-plugin/blob/4a57082d622234e757db709040b6e079ac85749d/src/features/parse/index.ts#L93

I had never updated this setting. Changing the language to something else and changing back to the default (en) seems to fix the issue for me.

benjypng commented 11 months ago

Sorry I am to able to reproduce this. Is it still happening?

meain commented 11 months ago

After updating to the newer version, I now get a different error:

RangeError: Format string contains an unescaped latin alphabet character `n`

This is when I use @today.

benjypng commented 11 months ago

Looks like a library issue.

Is it still parsing even with the error? I am still not able to reproduce it, i.e. I can parse without receiving any errors in developer tools.

meain commented 11 months ago

Is it still parsing even with the error?

Nope, nothing seems to happen.

Looks like a https://github.com/date-fns/date-fns/issues/1857.

Yup, I tried debugging it and it looks like it is coming from format here.

meain commented 11 months ago

I installed an update today. I am only having this issue after the update, but I can't seem to pin it to any particular commit. With the previous version (the one on the day I reported this bug), I was able to get it to work once I had reset the language.

Holanda73 commented 11 months ago

I cannot get it to work at all since some recent version.

v4.2.5 I have the language on nl. However I also tried in English and no luck either.

Normally typing @vandaag gave the me today's date in [[16-10-2023]]. Now nothing happens. I added a screenshot some examples: Scherm­afbeelding 2023-10-16 om 07 44 26

Here are my settings: Scherm­afbeelding 2023-10-16 om 07 41 43

Holanda73 commented 11 months ago

I wonder what I can check to figure it out?

Holanda73 commented 11 months ago

I wonder what I can check to figure it out?

Also checked this:

{
  "semiAuto": true,
  "insertDateProperty": false,
  "lang": "nl",
  "specialCharHeading": "",
  "dateChar": "@",
  "scheduledChar": "%",
  "deadlineChar": "^",
  "disabled": false
}
meain commented 11 months ago

Huh, that is interesting. Looks like using % and ^ works, but not @. EDIT: Ahh, these don't use getDateForPage which means it does not call into date-fns.

meain commented 11 months ago

@Holanda73 As for % not showing anything, you need to have some content in that block for logseq to show the scheduled date.

Holanda73 commented 11 months ago

@Holanda73 As for % not showing anything, you need to have some content in that block for logseq to show the scheduled date.

agree, sorry you are right, I just tested it. But indeed @ does not work. I even removed the plugin and re-installed it (in an earlier version) and it did not help.

benjypng commented 11 months ago

Hi @Holanda73 and @meain, can you share what languages you all are using?

I suspect what is happening is how the date formats are being returned on your respective computers and date-fns expects UTF-8 formats. Would like to confirm this.

meain commented 11 months ago

I have English both in my system and specified in the plugin settings(en).

Holanda73 commented 11 months ago

Language set is NL but see my language and regional settings

image
benjypng commented 11 months ago

Sorry for the delayed response. Could you try to see if v4.3.1 fixes the issue?

Holanda73 commented 11 months ago

Sorry for the delayed response. Could you try to see if v4.3.1 fixes the issue?

Seems it only works if the date text is the only text:

image
benjypng commented 11 months ago

Hmm, I still cannot reproduce it.

https://github.com/hkgnp/logseq-datenlp-plugin/assets/47936793/a7f0dee9-6514-430d-86a0-2bda0a99ae54

Maybe you can try uninstalling the plugin, close Logseq, delete logseq-datenlp-plugin_layouts.json and logseq-datenlp-plugin.json from .logseq/settings, open Logseq, and re-install the plugin?

Holanda73 commented 11 months ago

Hmm, I still cannot reproduce it.

vandaag.mov

Maybe you can try uninstalling the plugin, close Logseq, delete logseq-datenlp-plugin_layouts.json and logseq-datenlp-plugin.json from .logseq/settings, open Logseq, and re-install the plugin?

I closed Logseq and restarted again now it seems to work. In some weird case a time stamp appeared, but can't reproduce. So it seems to have been fixed now.

Appreciate the follow up !!!!

praveenperera commented 11 months ago

I had the same issue, what fixed it for me:

Uninstall -> Restart LogSeq -> Install

meain commented 11 months ago

Same here, looks like it is all good now. Lemme close the ticket! Thank again for the plugin :D