I am trying to create a custom javascript function. Whenever I return tp.file.existsit returns trueor false depending if the file exists or not but when I try to use it in a condition it always returns false. What is going on?
return tp.file.exists("blahblahblah") == false;
blahblahblah doesn’t exist so it should be false == false which should return true but it still returns false.
Manually typing false == false does actually return true.
That was part of the answer. The other part that I wasn’t aware of until I found out how to open the console was that javascript functions which use await need to be declared asynchronous. @AlanG, thanks for pointing me in the right direction. I’m still very new to Obsidian and javascript.
My question was a way to deal with daily notes in a way logical to me and at the same time learn how to do my own custom templater scripts. In my case my daily notes are in, unsurprisingly, Daily Notes/ and have the format YYYY.MM.DD - dddd. I wanted to add a link to the previous daily note, even if I hadn’t made a daily note in more than a day.