What I’m trying to do
I’ve got an issue with the periodic notes and calendar on both my Linux and Mac systems. I’d like to have the day of the week starting on Monday, so I set it to this in the plugins settings:
With that, I see for some time Monday as start of my week, as well as links to all my weekly notes:
Then, after some time, it resets to show Sunday as start of the week, hiding all the links to my weekly notes. I’ve to go into the settings again and unset and reset Monday as start of the week.
Settings:
About → Language: English
Calendar → Start week on: Monday
Calendar → Override locale: en-gb
System locale is en_US.
This happened to me both on my Linux and MacOS systems with the latest Catalyst Obsidian and updated plugins.
Any idea why this happens? Thanks!
Have you noticed any other settings anywhere reverting?
Are you syncing the vault (and if so what are you using to do that)?
Hi @CawlinTeffid , thanks for your reply!
I haven’t seen any other settings reversed. I’m syncing via git.
I found a way to recreate the change in the settings (on MacOS):
When starting up, it is correctly set to week starting on Monday
When I create a new week note with the calendar plugin, the week start switches to Sunday, with the same effects as noted above (week note links are also not visible anymore in the calendar plugin)
It is something in my Weekly Note template that causes the switch from Monday-start to Sunday-start! I just tried with an empty Weekly Note template, and the issue doesn’t appear.
I use the following slight complex template
<%_*
let granularity = "weekly";
let default_format = {daily: "YYYY-MM-DD", weekly: "gggg-[W]ww", monthly: "YYYY-MM", quarterly: "YYYY-[Q]Q", yearly: "YYYY"};
let periodic_settings = app.plugins.plugins["periodic-notes"].settings;
let full_patterns = Object.fromEntries(Object.keys(default_format).map(p => [p, periodic_settings[p].format || default_format[p]]));
let patterns = Object.fromEntries(Object.entries(full_patterns).map(([k, v]) => [k, v.split("/").slice(-1)[0]]));
let date = moment(tp.file.title, patterns[granularity]);
let journal_folder = periodic_settings[granularity].folder;
tp.file.move(journal_folder + "/" + date.format(full_patterns[granularity]));
let monday = date.clone().isoWeekday(1);
let sunday = date.clone().isoWeekday(7);
let prev_week = date.clone().subtract(1, "week");
let next_week = date.clone().add(1, "week");
_%>
---
year: <% date.format("YYYY") %>
month: <% date.format("YYYY-MM") %>
week: <% date.format("YYYY-[W]ww") %>
start-date: <% monday.format("YYYY-MM-DD") %>
mood:
---
# Week <% date.format("w") %> <small><% monday.format("D. MMM ") %> - <% sunday.format("D. MMM") %></small>
<%*
tR += `> [!hint] [[${monday.format(patterns.yearly)}|Y]]`;
if (monday.year() != sunday.year()) {
tR += ` · [[${sunday.format(patterns.yearly)}]]`;
}
tR += ` › [[${monday.format(patterns.quarterly)}|${monday.format("[Q]Q")}]]`;
if (monday.quarter() != sunday.quarter()) {
tR += ` · [[${sunday.format(patterns.quarterly)}|${sunday.format("[Q]Q")}]]`;
}
tR += ` › [[${monday.format(patterns.monthly)}|${monday.format("MMM")}]]`;
if (monday.month() != sunday.month()) {
tR += ` · [[${sunday.format(patterns.monthly)}|${sunday.format("MMM")}]]`;
}
tR += ` › [[${prev_week.format(patterns.weekly)}|«]] \
**[[${date.format(patterns.weekly)}|${date.format("[W]w")}]]** \
[[${next_week.format(patterns.weekly)}|»]] › `;
moment.updateLocale('en', { weekdaysMin: 'S_M_T_W_T_F_S'.split('_') });
tR += `[[${prev_week.isoWeekday(7).format(patterns.daily)}|«]] `;
for (let i = 0; i < 7; i++) {
let week_day = monday.clone().add(i, "day");
tR += `[[${week_day.format(patterns.daily)}|${week_day.format("dd D")}]]`;
if (week_day.isoWeekday() < 7) {
tR += " · ";
}
}
tR += ` [[${next_week.isoWeekday(1).format(patterns.daily)}|»]]`;
%>
#journal #weekly
summary:: ❔ <% tp.file.cursor(1) %>
```dataviewjs
await dv.view('journal-table', {
pages: dv.pages('#daily')
.where(p => p.week == dv.current().file.name)
})
<%*
tR += “> [!hint] ”
tR += [[${date.format(patterns.yearly)}|Y]]
for (let q_i = 0; q_i < 4; q_i++) {
let q = date.clone().month(q_i3)
tR += | [[${q.format(patterns.quarterly)}|Q${q_i + 1}]]
for (let month_i = q_i 3; month_i < q_i*3 + 3; month_i++) {
let month = date.clone().month(month_i)
tR += · [[${month.format(patterns.monthly)}|${month_i + 1}]]
}
}
tR += “ ”
%>
I'm trying to debug it further now.
Yay, found it! And it was my own fault .
I had the following part in my weekly note settings to have single-letter short-hands of the days:
moment.updateLocale('en', { weekdaysMin: 'S_M_T_W_T_F_S'.split('_') });
Which resetted the locale globally to ‘en’, which seems to be en_US. Deleting that line or changing it to
moment.updateLocale(moment.locale(), { weekdaysMin: 'S_M_T_W_T_F_S'.split('_') });
fixed the issue
1 Like
system
Closed
February 2, 2024, 9:19am
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.