question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FR: Fix the `ctime` of .md files based on "Date Created" frontmatter.

See original GitHub issue

Is Your Feature Request Related to a Problem? Please Describe.

Yes it is!!

One of the main pain point when migrating from Evernote to Obsidian is that the note’s ctime can often get lost/modified during syncing – either due to restrictions of sync services like Git (e.g. when i setup a new computer from a obsidian Git repo), or due to OS restrictions (Obsidian Sync cannot preserve file’s ctime on Linux),

To the point that, i cannot reliably view the notes sorted by their “create time” in the Obsidian’s Files Explorer.

Describe the Solution You’d Like

Since Linter already supports the feature to maintain a create timestamp in frontmatter, I wonder if it’d be possible to add a new option use create date YAML to set the ctime of the file, when they do not match.

Potential name for the new option: Sync "Date Created" to the file `ctime` (when mismatched)

Roughly logic (when the new option is turned on):

  1. if “Date Created” YAML does NOT exist -> fill it in just like today
  2. if “Date Created” DOES exist, and when it’s the SAME as the ctime of the file -> do nothing
  3. if “Date Created” DOES exist, and is DIFFERENT than the ctime of the file -> Update the file’s ctime using the “Date Created” value

Describe Alternatives You’ve Considered

  1. Currently, i rely on Dataview to generate a view using the “Date Created” frontmatter value. It works, but is somewhat awkward and requires keeping a separate note per folder that i’m interested in.

    It would be MUCH nicer if the sort order by “create time” in File Explorer can be reliably used 😃

  2. Alternatively, i could do the above using a custom script, but it would be much nicer if this is built-in into Linter (for batch-fixing all my notes) 😃


Thanks SO much for your considerations! 😃

(credit to @Antisimplistic on Discord for the brilliant idea!! 😃)

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:18

github_iconTop GitHub Comments

2reactions
pjkaufmancommented, Nov 7, 2022

I will close this once I get done with adding the lint all functionality for the custom lint rules. Thus far, I have been really trying to fix bugs and work out custom ignore rules. Hopefully it won’t be too much longer on this.

1reaction
pjkaufmancommented, Sep 3, 2022

I was thinkimg some more on this and I am not sure how maintainable that logic would be since it requires upsating file metadata. I am not saying it cannot be done, but testing and making sure it still works would require manual work since we would have to mock how obsidian works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spec: Export to Markdown with yaml front matter · Issue #5224
The following properties are suggested to be included in the Markdown+YAML export. Title; Created time (user_created_time, use selected date/time formatting) ...
Read more >
Is it possible to change the creation date of a note? - Help
It isn't reliable at the moment. There is a feature request for creation date to be preserved.
Read more >
Is there a way to add frontmatter to existing Markdown files
Yes, you can assign a hotkey to insert a specific template if you want. So you could create a template called "Modification Date"...
Read more >
jekyll yaml front-matter is turned into <hr> tag by markdown
I use notepad++ to edit the markdown files and the notepad++ is set to UTF-8 mode already. Now I parse the markdown files...
Read more >
GitLab Flavored Markdown (GLFM)
In GitLab, front matter is used only in Markdown files and wiki pages, ... the slug for a page that points to that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found