Replies: 1 comment
-
Of note: In ISO (german) locale, Tue May 31st is May W5, but Wed June 1st is June W1 (because same week as Sat June 4th). Somewhat similarly, in the US locale March 31st is March W5, but April 1st is April W1 (they're both March W5 in ISO locale). Sadly the reference document (TR 35) isn't of much help, as all it says on that placeholder is:
That seems like an indictment of the current behaviour of babel, but at the same time the lack of a "month of week" placeholder is an issue following the spec to the letter. |
Beta Was this translation helpful? Give feedback.
-
Heya @akx, asking for guidance here to get more information on possible fixes and how to proceed: a colleague recently discovered a discontinuity in the
YYYY w
pattern using the en_US locale, where it has a behaviour which is not coherent, and can "go back in time":Reading #621 it looks like this could be caused by
w
being intended as the "customary" week number (aka the first week contains Jan 1st), but it's not entirely clear because:The official documentation specifically defines
w
andY
in terms of ISO weeks, although TR#35 has a more waffly language which seems to allow for non-ISO calendar semantics. Per my reading it does imply coherence between week-year and year-week tho.The boundary condition is obviously strange as the week number changes mid-week (and the year fails to change so is definitely incorrect for Jan 1st and Jan 2nd).
I've seen people use such "split weeks" informally but it's not clear whether babel is supposed to support that or wants to support the so-called "traditional western" week calendar (where the week starts on Sunday, and the 1st week of the year contains Jan 1st, so Jan 1st is always the same week-year as its calendar year but up to 6 days of Dec might have a week-year of calendar-year + 1 e.g. here Dec 30 would also be W1 2021).
Is babel also supposed to follow the middle-eastern customary week numbering if the locale's week starts on sat? (same semantics as western trad., with the week starting on sat instead of sun)
Nota: when trying to understand what was happening here I first built up a test case to validate the iso behaviour, and it turns out there's a big hole at the boundary condition for #621, I'll try to provide a test and fix for that, though this is complicated by
get_week_number
pulling double duty. IsDateTimeFormat
considered public or is it an internal implementation detail?Beta Was this translation helpful? Give feedback.
All reactions