I configured the Daily Notes plugin with “Date Format” set so that my daily notes are automatically placed in folders for year, month, and week of year. When it comes to how Sunday is treated I get different results depending on the moment.js coding used
Thank you. I don’t think this is a duration calculation problem, but I can be wrong about that. I think it is either something wrong in moment.js or something in the way the first day of week is determined based on location information (locale).
I think (we all - including myself - “think” without some “technical” support or deep knowledge ) the question is related with the differences between moment formats and iso/luxon formats. For example, intuitively, we think 1st January is related with the start of the first week of the year; we think all formats works in the same way; we think that all formats consider the first day of the week (Sunday? Monday?) in equal mode…
But all these are “wrong” assumptions. The rules for the first week of the year are different for moment and iso formats (that’s why some differences between the use of WW [iso] and ww [moment]. (For example, see iso rules: ISO week date - Wikipedia)
By my personal experience, by this year there’s a difference of one week from one format for the other. In your example you get the difference of two weeks and not only one. I think this is because another difference: to one format the new week starts in Sunday, to other starts in Monday (if you try to tomorrow date, maybe the difference is reduced to one week).
And there’re others differences related with “locale” date formats (informed by your system).
So, as a conclusion, if possible, it’s important to define and use always the same format. For example, if anyone use many dataview dql queries -which works with ison/luxon format - it’s recommend to use the daily notes title format with iso tokens…
But if anyone could explain this with a more “technical” language, we appreciate.
Indeed. Though wonder if there is any connection. Apologies if it looked as though I was trying to hijack your thread. I posted as I thought the issues might be related, and I am hoping that the extra info might help @Licat and @Silver. Might be barking up the wrong tree. Would be useful to get some official clarification for this.
Please, don’t tag the devs. They will get flooded with notifications.
ISO weeks begin on monday and end on Sunday. The first week of the year always contains Jan 4th. Sunday 2022-03-06 is the last day of week 9.
The locale version depends on where you are. In the US, the first day of the week is Sunday and the first week of the year is the one that contains Jan 1st. Sunday 2022-03-06 is the first day of week 11.
If you want 2022-03-06 to be in week 10, then it sounds like you start weeks on Monday and count the first week of the year as the one that includes Jan 1.
Is your computer’s locale set correctly? That can affect how the calendar is set up because different places have different calendar customs. Check the language and/or time settings.
If that doesn’t help, the Calendar plugin enables you to set the first day of the week and/or override the system locale. Set it to Monday as use the “w” or “ww” syntax, and that should (hopefully) do what you want.
If you start your week on a Monday, you need to select a localization that uses Monday as the first of the week in Calendar/Advanced Settings. Otherwise it will be a week off. I have mine set for en-gb.
You may have to close and reopen the vault after changing it, I don’t remember for sure.