Week number confusion

Just encountered this problem when I was talking with my colleague.  He thought this week was week 43 but it actually was 42 on my calendar.  Turned out, there are two ways to look at week number.

First one is to simply take January first as a start of week one.  In case of 2021, January 1 is Friday.   depending of what you think as a first day of week, this year’s week 1 is only 2 days long or 3 days long, then Week 2 will start on either January 3rd(Sunday) or January 4th (Monday)

Excel function =WeekNum()  uses this approach.

Then there is a week number definition by ISO 8601.  According to ISO,  Week 1 is the first week of the year that has more than 4 days in a week.  Further more, first day of week will start on Monday.

With this definition, January first of 2021 does not qualify as a  week number 1.  A week starts on January 4th(Monday) is week number 1.

Excel also has function to calculate this as   =ISOWeekNum()

When I first turn on week number display on Outlook,  it showed the week number based on ‘January 1 as week 1’ approach.   This is not correct on many occasion. It appears majority of business now uses ISO week number.   You can change the settings in Outlook calendar to correct this.

In Outlook, go to File then select ‘Option’ then select ‘Calendar’  In Worktime  section, change ‘First day of week’ to ‘Monday’ then First Week of Year from ‘Starts on Jan 1’ to ‘First 4 day week’

Trying to code ISO weeknumber in typescript turned out to be a fun project but that is another story..