Calendar and tasks for daily notes

@danbburg, perfect! Thanks for the script!

I’m using dates with spaces (e.g. linkFormat="%Y-%m-%d (%A)" -> 2020-10-19 (Monday)) so I had to change all instances of $date_cmd +$linkTemplate to have quotes: $date_cmd +"$linkTemplate", or else date thinks there’s more than one argument.

Also, I didn’t like the non-existing notes link to have a blue color (hard to distinguish, despite the existing ones being bold), so I cleared all highlights (hle, hlne, hlt), added a span with a class to both dates:

 if [ -e "$testFile" ]; then # Daily note file exists
        printf "| $hil$hle<span class=\"journal-calendar-date\">[[ %s \| %s ]]</span>$hle$hil " "`$date_cmd +"$linkTemplate" […]
    elif [ "$linkNonExisting" == true ]; then # Daily note file does not exists, but still make a link
        printf "| $hil$hlne<span class=\"journal-calendar-date\">[[ %s \| %s ]]</span>$hlne$hil " "`$date_cmd +"$linkTemplate" […]

and added it to obsidian.css:

.journal-calendar-date a.internal-link.is-unresolved {
    color: white;
}

This way there’s no need to re-run the script to check for existing notes (just run it once per year!) and the style will change automatically.

Result:
image

Thanks again! :grinning:

4 Likes

https://gist.github.com/jdbrice/3b7395d7f1ff724a744a26ab9bfd078b there is the original code. i just change it a little bit. (mostly for German translation and European ISO format)

I’m just wondering whether the idea of highlighting today’s date in the Calendar was ever developed further. I use the default Calendar that has today’s day in bold, but I would love a more conspicuous appearance like a fully highlighted square.

I have got inspired and created script in obsidian templater for automatic calendar creation in periodic notes.

1 Like