Uniform journal page date formatting; only use date format setting to render dates displayed to user

Currently, the date format (e.g., yyyy-MM-dd EEEE) that Logseq uses for journal pages is used both in the filename on disk and throughout the UI. This can get very confusing very fast when you wish to switch to a different date format, as any references to journal entries will now use the wrong name. In addition, when referencing a future date, it is difficult to reference it when the weekday is in the journal date format because you likely don’t know the days of the week that future dates are. And it can make it inconvenient to type out the date in general — do you really want to have to type MMMM do, yyyy each time? A shortcut for that would be nice.

I think it would be much simpler if behind the scenes, Logseq universally stored dates with some fixed, unchanging format, e.g., yyyy-MM-dd. Then, the date format setting would only control how dates are displayed to the user in the Logseq UI. So if your date format were set to EEEE, yyyy/MM/dd:

  • You would type either [[2023-05-06]] or [[Saturday, 2023/05/06]] to reference the page for May 6, 2023
  • In the markdown itself, Logseq would store [[2023-05-06]]; if you actually typed [[Saturday, 2023/05/06]], Logseq would do the conversion once focus left that block
  • The filename of that journal page would be journals/2023-05-06.md
  • Logseq would display that journal page’s title as Saturday, 2023/05/06
  • The reference [[2023-05-06]] would be rendered as [[Saturday, 2023/05/06]] when focus was not in that block (the same way that _abc_ is rendered as abc).
  • etc

Basically Logseq would only store the date as 2023-05-06 and then render that as Saturday, 2023/05/06 whenever the rendered date was displayed to the user.

Thoughts?

Logseq should be used for displaying user date formats, rather than writing them directly into Markdown files.

Firstly, the date format and journal flag in Logseq are not optimal. Ideally, the journal-day property should take precedence and be handled on a per-page basis. Instead of directly writing the date format in markdown files, there should have been a conversion process at the display stage.

Regarding this issue, many users have already created their graphs, which poses a challenge as old data formats may linger in the files. There are two potential ways to address this hurdle:

  1. Perform a character replacement process on all files to update the date format.
  2. When opening links or similar items that match the old date format, replace them with the journal-day format to make the link effective. However, this would require a process to determine whether each link corresponds to a date format each time.
    When presenting the information, utilize the journal-day property to convert and display it in the new date format. This is less expensive if caching is implemented.

alias: Journal references in notes are not modified when change the journal data format · Issue #4279 · logseq/logseq · GitHub

2 Likes

Published Legacy date format plugin and Flex date format plugin

With the help of these two plugins, it is possible to separate the date format used for recording in files from the format used for display.:ok:

8 Likes

Thank you for this! I walked into this today, assuming that the setting in preferences was related to the display of the date, not how it was written to disk.

1 Like

Thank you, highly appreciate.

2 Likes