obsidian-periodic-notes icon indicating copy to clipboard operation
obsidian-periodic-notes copied to clipboard

Weekly Notes confusing week number

Open datavistics opened this issue 2 years ago • 8 comments

Its Sat Feb 19. When I create a weekly note:

  1. The note file name is W06
  2. The Calendar highlights it on last week which is W07
  3. This week in the calendar is actually W08 image

This is my note name: YYYY/[Weekly]/gggg-[W]WW

datavistics avatar Feb 19 '22 12:02 datavistics

From what I can see periodic notes plugin gets confused only when calendar plugin is also installed (or enabled). Was noticing this problem as well. Everything went away after removal of calendar plugin.

Maybe fiddle with locales in the calendar plugin to setup first day of week.

mchwalisz avatar Mar 28 '22 21:03 mchwalisz

I tried Locale default - Sunday, Sunday, and Monday but got the same results. image

datavistics avatar Mar 29 '22 04:03 datavistics

@mchwalisz @liamcain any ideas?

datavistics avatar Mar 29 '22 04:03 datavistics

I removed the calendar plugin and it started to work as expected. I, however, understand this is not really solution you are looking for.

Maybe one should also raise awareness in the calendar plugin. One needs to debug where the behavior change is coming from. I don't have time and expertise to look into it.

mchwalisz avatar Mar 31 '22 08:03 mchwalisz

It seems like the the en-us locale is not using ISO week numbers. It works for me when I override the locale to en-ie for Ireland.

Quick unrelated question: What do I need to do to link the previous and next weekly note in my template? There's nothing in the docs about that. Thanks!

stefandesu avatar Apr 10 '22 16:04 stefandesu

@stefandesu that seemed to help!

I used this btw: [[<%tp.date.now("gggg-[W]WW", -9)%>]] <== This Week ==> [[<%tp.date.now("gggg-[W]WW", 2)%>]]

datavistics avatar Apr 11 '22 09:04 datavistics

I rewrite your code to work even when creating a weekly note for a future or past week:

[[<% tp.date.weekday("gggg-[W]WW", -7, tp.file.title, "gggg-[W]WW") %>]] <== This Week ==> [[<% tp.date.weekday("gggg-[W]WW", 7, tp.file.title, "gggg-[W]WW") %>]]

Requires that the note is named accordingly of course, e.g. 2022-W15.

stefandesu avatar Apr 12 '22 09:04 stefandesu

This issue has been discussed in several issues in obsidian-calendar, ie. in liamcain/obsidian-calendar-plugin#222

Thanks for the Templater template, @stefandesu. That's really helpful, it should be included in the official documentation.

Related liamcain/obsidian-calendar-plugin#248 Related liamcain/obsidian-calendar-plugin#247 Related liamcain/obsidian-calendar-plugin#222 Related liamcain/obsidian-calendar-plugin#206 Related liamcain/obsidian-calendar-plugin#183 Related liamcain/obsidian-calendar-plugin#128

Related #95 Related #55 Related #41 Related #17 Related #13

fkuersch avatar Jun 08 '22 08:06 fkuersch