date-format icon indicating copy to clipboard operation
date-format copied to clipboard

How is weekOfYearNumber supposed to behave?

Open vileanco opened this issue 4 years ago • 0 comments

I am wondering how is the weekOfYearNumber intended to work? It seems that it does work properly when the year changes, eg. week number can jump from 53 to 1 while day of the week is changing from Tuesday to Wednesday.

For example:

Tuesday 2019-12-31 18:00 GMT (posix 1577815200000) gives output week=53 Wednesday 2020-01-01 18:00 GMT (posix 1577901600000) gives output week=1

If I have understood correctly, there are several standards on how to calculate the week number but for example ISO week date states that "Each week's year is the Gregorian year in which the Thursday falls". So in the previous example Tuesday should also be part of week 1 of year 2020 if following the ISO week date standard.

vileanco avatar Jul 23 '20 07:07 vileanco