Hello. Thanks for the library. Came across an edge case in setUTCWeek. If we're on 2009-W53-07 (Sun 3 Jan 2010) and we call getUTCWeek() we get 53, as we should.
However, if we then call setUTCWeek(53) we'll get a totally different date back - Mon, 03 Jan 2011 00:00:00 GMT.
I changed setUTCWeek to use a new function getUTCWeekNumberingYear() (nomenclature source) which'll return 2009 for UTC(2010,1,3). This then gets us to 2009-W53-01 as the documentation states.
There's 2 commits in the PR - the first that fails, the second that passes with the new code.
i rebased this onto master. afterwards, i restructured things a little so that getWeek/setWeek shared the common logic calculating the current week's year. thanks for finding this bug and providing a fix.
Hello. Thanks for the library. Came across an edge case in
setUTCWeek
. If we're on 2009-W53-07 (Sun 3 Jan 2010) and we callgetUTCWeek()
we get 53, as we should.However, if we then call
setUTCWeek(53)
we'll get a totally different date back - Mon, 03 Jan 2011 00:00:00 GMT.I changed
setUTCWeek
to use a new functiongetUTCWeekNumberingYear()
(nomenclature source) which'll return 2009 for UTC(2010,1,3). This then gets us to 2009-W53-01 as the documentation states.There's 2 commits in the PR - the first that fails, the second that passes with the new code.