Why Your Calculated Week Number Didn't Match Your Calendar App
This usually happens because the two sources use different week numbering conventions — ISO 8601 (weeks start Monday, week 1 contains the year's first Thursday) versus a simpler convention some apps use (week 1 starts January 1st, or weeks start Sunday instead of Monday) — both are internally consistent, just different standards.
A week number mismatch between two tools is almost never a bug in either one — it's a sign the two are using genuinely different, both-valid conventions.
Different week-start days
ISO 8601 weeks start on Monday, while some regional conventions (notably in the US) start weeks on Sunday — this alone can shift which days belong to which numbered week, especially for dates near the boundary between two weeks under one convention but not the other.
Different rules for where week 1 begins
Some simpler systems define week 1 as simply the week containing January 1st, regardless of how many days of that week fall in the new year — this differs from ISO's "first Thursday" rule and can shift numbering by one week for dates near the year boundary.
Checking which convention a specific app uses
Most calendar apps allow configuring which week-numbering standard to use, or default to a specific one based on regional settings — checking a specific app's settings, or comparing its output against a known ISO week number reference for a test date, clarifies which convention it's actually applying.