Hey @dryice! I’ve actually once written two complete moment.js addons for rounding date/time and generating date/time intervals. These are a little more complicated and not so easy to add to Obsidian, so here are two simpler solutions, maybe one of these fits your bill:
Very simple (and ugly) solution without Javascript:
Hello @Moonbase59 – I’m reading through this read and this is a wealth of knowledge. You’re a true tinkerer. I’m running into trouble and wanted to see if you saw something I was doing simply wrong or if you knew of a smart way to achieve this.
I’m looking to dynamically link all the months in a quarter, depending on the quarter. As such, I was planning on writing something like:
Done some digging and found that, if we change locale in “About” setting of obsidian based on that moment.js decides weekday will be Sunday or Monday.
I wanted Monday and Locale as “English”.
One work around I found is Calendar plug-in has setting Start week on, this also changes behavior of moment.js.
I was able to figure it out finally. Just to clarify it calculates the days of the week given a title like 2022-W20 and links it to the daily notes for that week, which I have formatted as YYYY-MM-DD
<% a = new Array(moment(tp.file.title,'YYYY-[W]ww').endOf('week').day() -moment(tp.file.title,'YYYY-[W]ww').startOf('week').day()+1).fill(null).
map((x, i) => moment(tp.file.title,'YYYY-[W]ww').startOf('week').add(i, 'days').format("- [[[] YYYY-MM-DD [|] ddd [⦗]YYYY-MM-DD[.⦘]]]")).join('\r\n')
%>
How would I get a date that happens every 28 days? In other words, I have something I have to do every 28 days. Ideally, the output would be MM-DD-YYYY. I want to incorporate it into my daily notes.