itchyny / calendar.vim

A calendar application for Vim
MIT License
1.95k stars 72 forks source link

Calendar shows wrong week numbers #99

Closed lervag closed 8 years ago

lervag commented 8 years ago

Hi. When I open the calendar, it shows wrong week numbers for 2016. Monday january 4th is the start of week 1 (at least it is so in Norway).

I notice that with the common unix tool cal, run with cal -w, I get the same behaviour as with this plugin. However, if I state that the week starts on Monday, i.e. cal -wm, then the unix tool correctly shows that the week number starts with 1 on January 4th.

itchyny commented 8 years ago

Okay. I'll fix this. I didn't know the correct definition of week number... https://en.wikipedia.org/wiki/ISO_week_date https://en.wikipedia.org/wiki/Week#Week_numbering Due to the above links, the week 1 is assign to the week containing 1/4 on calendars beginning with Monday, and to the week containing 1/1 on calendars beginning with Sunday. The current implementation seems to follow the latter rule.

itchyny commented 8 years ago

Fortunately the week numbers in the last year on both calendars are correct because 2015/1/4 is Saturday.

lervag commented 8 years ago

Thanks for the links, interesting to read about the correct definitions of the first week number.

lervag commented 8 years ago

Thanks! :D

itchyny commented 8 years ago

:)