obsidian-calendar-plugin icon indicating copy to clipboard operation
obsidian-calendar-plugin copied to clipboard

Week number different in Linux version

Open kmaustral opened this issue 3 years ago • 21 comments

Before Submitting: Double-check that you are running the latest version of the plugin. The bug might have already been fixed 😄

Describe the bug

The Linux version of Calendar is a week ahead. The week beginning 30 May is numbered 23. But it is 22 on Windows and mobile versions.

Expected behavior

The week numbers would align with the calendar the same.

Environment (please specify)

Linux on Chrome OS

Obsidian Version (e.g. v0.10.6)

0.12.4

kmaustral avatar May 31 '21 12:05 kmaustral

I can confirm that this also happens in macOS.

Obsidian version: 0.12.4 Plugin version: 1.5.10

tfurtado avatar Jun 15 '21 08:06 tfurtado

Yeah… seems to be happening to me too. My current guess is that the week numbers in the Calendar plugin are not using the locale properly to change between ISO and en-us.

OSX local settings image

Fantastical current week number image

Obsidian Week Plugin Settings image

Obsidian Week Display image

This is actually kinda confusing… because the current ISO week for June 29th is 26 according to https://www.epochconverter.com/weeknumbers, and fantastical agrees.

I wonder if it's moment.js, but here's what moment says about the week number: I have this dataviewjs snippet in my weekly note to pull daily notes related to it:

let p = function(b) {
  switch(b) {
    case "": return ""; break;
    case " ": return ""; break;
    case 0: return "❌❌❌"; break;
    case 1: return "🔴⚪️⚪️"; break;
    case 2: return "🟡🟡⚪️"; break;
    case 3: return "🟢🟢🟢"; break;
  }
}

let start = moment(dv.current().file.name, "gggg-[W]ww").add(7, "d");
let end = start.clone().add(6, 'd');

dv.header(2, `Dailies: ${start.format("MM-DD")} - ${end.format("MM-DD")}`)
dv.table(
  ["Daily", "Husband", "Father", "Work"], dv.pages('"journal/daily"')
    .filter(d => moment(d.file.name).isBetween(start, end))
    .map(d => [d.file.link, p(d.husband), p(d.father), p(d.work)])
)

and for W26 it returns: image

(which appears to be right.)

dates and times are hard y'all!

evantravers avatar Jun 29 '21 11:06 evantravers

Currently installed plugins:

calendar
dataview
media-extended
nldates-obsidian
obsidian-advanced-uri
obsidian-excalidraw-plugin
obsidian-git
obsidian-kanban
obsidian-kindle-plugin
obsidian-mind-map
obsidian-style-settings
obsidian-system-dark-mode
periodic-notes
review-obsidian
table-editor-obsidian

evantravers avatar Jun 29 '21 13:06 evantravers

I am able to reproduce the issue. I will make a fix as soon as possible.

liamcain avatar Jun 29 '21 13:06 liamcain

@liamcain awesome! Ping me if you need a dev-test.

evantravers avatar Jun 29 '21 14:06 evantravers

(Side note, the Periodic Notes plugin has the same problem while selecting the week note… I believe the two are related.)

evantravers avatar Jul 02 '21 01:07 evantravers

It seems also applicable for Android mobile app. Google week number is different than obsidian calendar week number IMG_20210822_055444.jpg

OlegLustenko avatar Aug 22 '21 03:08 OlegLustenko

For funsies, this occurs on a completely bare Obsidian Vault, where the only community plugin installed is Periodic Notes.

evantravers avatar Aug 24 '21 19:08 evantravers

Just to confirm I have the same. Fairly new install of Obsidian (installed yesterday), Calendar was the first plugin I installed. Week numbers are off by one. macOS here. I have my system set to English for everything GUI but have Swedish locale (I type 50/50 English/Swedish). According to https://weeknumber.com/ it is currently w37. My macOS calendar agrees, but my Obsidian Calendar says w38.

hellquist avatar Sep 18 '21 20:09 hellquist

This is still an issue on MacOS (11.4) with the latest version of Obsidian and the Calendar plugin. Any fix in the making?

RoamStack avatar Oct 04 '21 10:10 RoamStack

FWIW it "fixed itself" for me when I, in Calendar settings (within Obsidian that is) set it to "en-gb" as opposed to just "en" (I already had it on "Monday" for day to start the week).

hellquist avatar Oct 04 '21 10:10 hellquist

FWIW it "fixed itself" for me when I, in Calendar settings (within Obsidian that is) set it to "en-gb" as opposed to just "en" (I already had it on "Monday" for day to start the week).

Yep the "en-gb" hack worked for me too. Thanks

huyz avatar Oct 20 '21 11:10 huyz

So yes… this works. I'm not proud of it, but I'm currently using en-gb as well.

evantravers avatar Oct 20 '21 12:10 evantravers

Hi. I just want to add another data point. I run Obsidian on Windows (en-us). The week number is fine unless I set the week to begin on Monday. In that case, it is off by one. Switching to en-gb sets the week correctly. I hope you can fix the bug, but I'm glad there's a workaround. Thanks for the great plugin.

dbc60 avatar Oct 31 '21 12:10 dbc60

Unfortunately, the en-gb switch has not worked for me on my installation. Currently, the calendar shows the first week in 2022 as being the week of Dec. 26, 2021 - Jan. 1, 2022. The ISO standard would list this as the last week of 2021 rather than the first week of 2022, it seems.

Screen Shot 2021-11-01 at 3 21 41 PM

Bartlebooth1424 avatar Nov 01 '21 19:11 Bartlebooth1424

FWIW it "fixed itself" for me when I, in Calendar settings (within Obsidian that is) set it to "en-gb" as opposed to just "en" (I already had it on "Monday" for day to start the week).

Thanks for that. On MacOS latest, switching to en-gb worked for me. This carried through to iOS as well.

ngracilla avatar Jan 04 '22 15:01 ngracilla

FYI, the en-gb works, but there's one caveat with the Natural Language Dates Plugin. It parses dates in en-gb format because this settings is system wide.

en-us: typically does @MM/dd (month/day) en-gb: parses dates as @dd/MM

Example side effect with the date format of YYYY-MM-DD ddd:

en-gb @10/1: [[2022-01-10 Mon]] @1/10: [[2022-10-01 Sat]] @2022/10/1: [[2022-10-01 Sat]] @1/10/22: [[2022-10-01 Sat]]

en-us @10/1: [[2022-10-01 Sat]] @1/10: [[2022-01-10 Mon]] @2022/10/1: [[2022-10-01 Sat]] @1/10/22: [[2022-01-10 Mon]]

Note: you'll need to restart Obsidian for the setting to apply to Natural Language Date

kevinawoo avatar Apr 16 '22 19:04 kevinawoo

Related #248 Related #247 Related #222 Related #206 Related #183 Related #128

Related liamcain/obsidian-periodic-notes#95 Related liamcain/obsidian-periodic-notes#55 Related liamcain/obsidian-periodic-notes#41 Related liamcain/obsidian-periodic-notes#17 Related liamcain/obsidian-periodic-notes#13

fkuersch avatar Jun 08 '22 07:06 fkuersch

pt-br on linux also with this issue: https://github.com/liamcain/obsidian-periodic-notes/issues/131

Hoping and rooting for a fix as this causes quite some friction for two such amazing plugins!

lpanebr avatar Dec 31 '22 14:12 lpanebr

Update 2: ignore. I'm revising this.

I just noticed something else: When using GGGG-[W]W as suggested in the FAQ, the plugin tries to create a week number offset by 2 instead of 1:

  • On linux, pt-br, plugins updated on obsidian v1.1.9
  • GGGG-[W]W - Weekly Notes format
  • 53 - Week shown on Calendar plugin
  • 52 - Week shown on Google Calendar
  • 51 - Week created by the Periodic notes plugin

Periodic notes plugin: image

Calendar plugin week: image

Google week: image

Update 1

😮 😆 Oddly (and gladly) the Calendar highlights the correct week for the open note despite showing the wrong week number!

lpanebr avatar Dec 31 '22 15:12 lpanebr

I had this issue as well and changing locale to "en-gb" did not fix.

I ended up changing the Periodic Notes Weekly Notes Format from "YYYY-[Wk]-WW" to "YYYY-[Wk]-ww" and this worked. Periodic Notes should now name and parse files based on locale week of the year instead of ISO week of the year according to Moment.js format reference.

etotheten avatar Jan 27 '24 22:01 etotheten