You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These functions work by counting how many Thursdays have occurred up to this date
function formatUTCWeekNumberISO(d, p) { d = UTCdISO(d); return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2); }
Unfortunately the argument d is re-assigned and can cause the year to roll over, so that utcYear(d) returns a different year because UTC is in a different timezone
ISO weeks do rollover, and the results shown by this codepen seem correct to me. The two last days of 2019 (Dec 30 and 31) belong to Week 01, see for example http://www.whatweekisit.org/calendar-2019.html
These functions work by counting how many Thursdays have occurred up to this date
function formatUTCWeekNumberISO(d, p) { d = UTCdISO(d); return pad(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2); }
Unfortunately the argument
d
is re-assigned and can cause the year to roll over, so thatutcYear(d)
returns a different year because UTC is in a different timezoneCodepen: https://codepen.io/28raining/pen/VwqYaKL?editors=1111
Using a separate variable avoids this
function formatUTCWeekNumberISO(d, p) { var dUTC = UTCdISO(d); return pad(utcThursday.count(utcYear(d), dUTC ) + (utcYear(d).getUTCDay() === 4), p, 2); }
The text was updated successfully, but these errors were encountered: