5 ms·
First day of the week in the US is Sunday, first day of the week in the EU is Monday.
by strombofulous 6y ago
First day of the week in the US is Sunday, first day of the week in the EU is Monday.
- vesinisa 6y agoThat does not explain it. In US weeks more of W53/2020 lies in 2020 than in ISO weeks, but my phone still labels it W1/2021.
- masklinn 6y ago> In US weeks more of W53/2020 lies in 2020 than in ISO weeks Your error is in assuming every week is uniquely identified as a week-year, but that's only true in ISO week numbering. In ISO, every week-year is exclusive and whichever week contains January 4th is the first of the year, so 2020-12-28/2021-01-03 is 2020-W53 and 2021-01-04/2021-01-10 is 2021-W01 But in the US whichever week contains Jan 1st is the first… and whichever week contains December 31st is the last of the previous year. Meaning the same week can be both X-W53 and X+1-W01 (aka the US system has overlapping / partial weeks at both start and end of year). This is exactly the case this year (and most years, really), the week from December 27th (Sunday) to January 2nd (Saturday) contains both January 1st and December 31st, meaning it's both the last week of 2020 and the first week of 2021.
- vesinisa 6y agoRight, I figured something like this had to be in play. But by whom and where is this US week numbering system actually defined? I can see it is probably implemented in Java by java.time.temporal.WeekFields#SUNDAY_START, but there is no reference to any standard that actually defines it in the documentation. Just this (oddly worded) claim: "This week definition is in use in the US and other European countries."
- masklinn 6y ago> But by whom and where is this US week numbering system actually defined? I don't think there is any formal definition, it's just customary. AFAIK americans don't really use week numbering so it's not really a thing. OTOH ISO defines a very strict week-based calendaring system. Anyway SUNDAY_START defines that weeks start on sunday and the first week-of-year needs only contain a single day, so I expect you can never get the "overlapping" information from the JDK, it just considers that W01 is whichever week contains 01-01 and forgets about the overlapping last week of the previous year, if any.
- vesinisa 6y agoSo, we have the en-US locale returning arbitrary week numbers in a system that is not really well-defined or even used by anybody - in lieu of using the one and only standardized week numbering system. If a person asks a computer for a "week number 23 of 2021", the only sensible solution in any culture I think would be to use the ISO system. Only locale dependent thing should be on which "ISO week number" the Sunday falls. My point is the "customary US system" seems to actually have nothing to do with week numbering - or has anyone actually heard someone say "23rd week of 2021" or such? This system seems to only make sense when talking about ordinal weeks in and around the New Year, meaning terms like "first week of 2021", "second week of 2021" or "last week of 2020". But those are ambiguous, even in cultures that use ISO weeks. In my country ISO weeks are used extensively in business, but if you were talking about "first week of 2021" (ordinal), I would think you're talking about the week on which January 1 falls - same as the "US customary" system. But if you said "week 1 of 2021" (cardinal) I would understand immediately it as the ISO week 1 of 2021, which I know from experience is not always the same as "first week of 2021".
- masklinn 6y ago> If a person asks a computer for a "week number 23 of 2021", the only sensible solution in any culture I think would be to use the ISO system. No, because it wouldn't match american the expectations of people not using ISO calendars, despite and regardless of weeknumbers not being routinely used by them. It is an argument that maybe weeknumbers should not be a thing / available in all locales, but not that they should be renumbered to match an other locale, regardless of that other locale making more sense.
- vesinisa 6y agoBut ... haven't we established that the en-US locale week numbering system is not really based on anything sensible. So how the user can have any sensible expectation of what they get as a reply when they ask for a week number? I tried to research the glibc version control history of how it came to be like this. I think it's completely arbitrary, and at times en-US did use ISO 8601 weeks.