sawhney17 / logseq-smartblocks

MIT License
171 stars 12 forks source link

Date should honour Logseq date format settings #7

Closed danieltomasz closed 2 years ago

danieltomasz commented 2 years ago

Again, many thanks for making/porting this plugin!

My request: date format should depend from Logseq EDN settings currently, when I use the template <%Today%> I am getting [[Jan 26th, 2022]], but I am expecting [[2022-01-26]]

In my config.edn I have

 :date-formatter "yyyy-MM-dd"

I would propose for the plugin to inherit those settings for date format

sawhney17 commented 2 years ago

It  should ideally already be doing that. it doesn’t use the config.edn value but rather the value that you deifned in the in built settings. Date formatter is not the official or recommended approach to setting the date format. Could you try setting this in config.edn :journal/page-title-format "MMM do, yyyy”or perhaps setting the date format from settings? It creates a slightly different config.edn entry and that’s what’s taken as input On 27 Jan 2022, 3:02 AM +0400, Daniel Borek @.***>, wrote:

Again, many thanks for making/porting this plugin! My request: date format should depend from Logseq EDN settings currently, when I use the template <%Today%> I am getting [[Jan 26th, 2022]], but I am expecting [[2022-01-26]] In my config.edn I have :date-formatter "yyyy-MM-dd" I would propose for the plugin to inherit those settings for date format — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

danieltomasz commented 2 years ago

My full settings earlier were

 :journal/page-title-format "yyyy-MM-dd"
 :journal/file-name-format "yyyy-MM-dd"
 :date-formatter "yyyy-MM-dd"

I would like to have this ISO format of dates due to interoperability with other apps

sawhney17 commented 2 years ago

That seems like a bug then. I'll be investigating it On 27 Jan 2022, 5:25 PM +0400, sawhney17/logseq-smartblocks @.***>, wrote:

:journal/page-title-format "yyyy-MM-dd" :journal/file-name-format "yyyy-MM-dd" :date-formatter "yyyy-MM-dd"

I would like to have this ISO format of dates due to interoperability with other apps

sawhney17 commented 2 years ago

Found the cause. Looks like the date format is getting stuck in cache. It's an issue when changing the date format after the plugin has already been installed. Try reinstalling the plugin.

danieltomasz commented 2 years ago

Yes, reinstalling the plugin solved it! Thanks! But I didnt change the format after I installed the plugin. I will mark it as solved anyway.

danieltomasz commented 2 years ago

today {{renderer :smartblock, today-date,Today, true}} it was back displaying [[Jan 30th, 2022]] format, after reinstall it come back to [[2022-01-30]], but I would prefer to not reinstall plugin everyday :)

Great work with the plugin though!

sawhney17 commented 2 years ago

I believe this new release should solve it for good. Looks like the date format was not staying in sync with Logseq's and only refreshed once the whole plugin was refreshed.