nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
3.04k stars 134 forks source link

Week number is off by one week #92

Closed hellquist closed 3 years ago

hellquist commented 3 years ago

Are you using "tree-sitter" branch?

No

Describe the bug

In the Agenda week view the week number is off by one. Right now it is week 37. My week-agenda says it is week 38. https://weeknumber.com/ as well as my macOS Calendar both agree that it in fact is week 37.

Steps to reproduce

Open agenda view <leader>o-o-a Read parenthesis after "Week-agenda (W38)"

Expected behavior

I would have expected it to say "Week-agenda (W37)".

Emacs functionality

No response

Screenshots and recordings

image

OS / Distro

macOS 11.6

Neovim version/commit

v0.5.0

Additional context

No response

kristijanhusak commented 3 years ago

Good catch. I didn't spend too much time making sure this is correct. Should be fixed now.

garyhurtz commented 3 years ago

Interesting, a few weeks ago I was in the process of submitting a report detailing that the previous week number calculation was incorrect (it reported one week too early), when one of the updates apparently "fixed it" so I stopped. But, that update has apparently now been reverted.

I haven't checked the new code, but you previously defined W1 as the week that contains January 1, whereas many tools (Google calendar, Gnome calendar, etc) and most corporate calendars I have used follow ISO8601 which defines W1 as the week that contains the first thursday of the year. Some years they are the same, others (like 2021) are offset by a year.

If Apple uses the non-ISO calculation, would a config option to select ISO vs not be reasonable?

kristijanhusak commented 3 years ago

@garyhurtz I did fix it now to use ISO8601 as you said (test that verifies it: https://github.com/kristijanhusak/orgmode.nvim/blob/tree-sitter/tests/plenary/object/date_spec.lua#L742-L769)

Do you maybe know how Emacs works in the non-ISO environment, or is there a way to configure it? I'd like to mimic Emacs orgmode as much as possible.

I found only this where someone is trying to modify the number to something completely different, but I don't think that level of flexibility is needed.

garyhurtz commented 3 years ago

Interesting, after the update I saw the WW discrepancy return. After a restart and re-update it is now fixed. Apologies, something apparently went wrong in my initial update.

I don't use emacs, and when I looked into this the first time couldn't determine which calculation they use. I had found the linked item, which is what originally made the config option seem reasonable and consistent.

Thanks for all the effort on orgmode, and sorry again for creating noise from a local update issue.