Fix Logseq dates
This is a CLI tool to fix the date references following a change in date format since the current version (0.4.4) of Logseq does not support this yet.
I built this because I had a similar issue as reported on the Logseq forum and Discord.
It requires Python 3.6+ to run.
Install using pipx if you have it already. Otherwise you can use pip.
Via pipx (Recommended)
pipx install git+https://github.com/idadzie/fix-logseq-dates
pip install git+https://github.com/idadzie/fix-logseq-dates
How to use
usage: fix-logseq-dates [-h] [-f FORMAT] [-j JOURNALS_DIRECTORY] [-p PAGES_DIRECTORY] [-d GRAPH_DIRECTORY] [--any-date] CLI tool to fix linked references for Logseq dates. optional arguments: -h, --help show this help message and exit -f FORMAT date format. (default: MMMM DD, YYYY) -j JOURNALS_DIRECTORY journals folder name. (default: journals) -p PAGES_DIRECTORY pages folder name. (default: pages) -d GRAPH_DIRECTORY absolute path to your local Logseq graph. (default: None) --any-date match any date found not only referenced ones. (default: False)
Backup your Logseq graph (directory/folder that contains your markdown files). A simple copy to another directory is enough.
fix-logseq-datescommand against your Logseq graph. See here for supported date format tokens.
# Example fix-logseq-dates -f 'MMMM DD, YYYY' -d ~/path/to/knowledge-graph # If you've modified the Journals and/or Pages directories. fix-logseq-dates -f 'MMMM DD, YYYY' -d ~/path/to/knowledge-graph -j alt_journals -p alt_pages # Match any date strings in the files. # Use with caution. It might modifiy unintended dates. fix-logseq-dates -f 'MMMM DD, YYYY' -d ~/path/to/knowledge-graph -j alt_journals -p alt_pages --any-date
Open Logseq and re-index your graph.
If you are familiar with git and have some time to spare, you could initialize your Logseq graph as a git repository before running the fix. Then, after the fix, you could use a visual diff tool like to verify your data was modified correctly.
Like this project ?
If you think this project is cool.