Red Hat Bugzilla – Bug 80212
Swedish (sv) locale info has wrong first_weekday and first_workday
Last modified: 2007-04-18 12:49:13 EDT
This is a split-up of bug 56657.
With glibc-2.2.93-5 as shipped with Red Hat Linux 8.0, and using the sv_SE
locale, one gets this:
$ locale first_weekday
$ locale first_workday
This is clearly wrong, as Monday and not Sunday is used as the first day of week
in Sweden (please see
http://www.se.gnome.org/sv/lokal/datum_och_tid/index.en.html for details).
Hence, these values in glibc for the sv_SE locale should get corrected, and use
Monday as first_weekday and first_workday.
Reported also upstream as
In http://www.dkuug.dk/JTC1/SC22/WG20/docs/n972-14652ft.pdf, the following is
Is used to define the number of days in a week, and which weekday is the first
weekday (the first weekday has the value 1), and which week is to be considered
the first in a year. The first operand is an integer specifying the number of
days in the week. The second operand is an integer specifying the Gregorian date
in the format YYYYMMDD, and it specifies a day that is a first weekday (all
other first weekdays may then be calculated by adding or subtracting a whole
multiplum of the number of days in the week as specified with the first
operand). The third operand is an integer specifying the weekday number to be
contained in the first week of the year. The third operand may also be
understood as the number of days required in a week for it to be considered the
first week of the year. If the keyword is not specified the values are taken as
7, 19971130 (a Sunday), and 7 (Saturday), respectively. ISO 8601 conforming
applications should use the values 7, 19971201 (a Monday), and 4 (Thursday),
respectively. This keyword is optional.
Since Sweden uses ISO8601, the value of "week" should probably also be changed
according to the last part of the above.
From the specifiation cited above (ISO/IEC 14652:2002(E)) it is obvious that the
value of 'week' is the one that should be changed (at least for swedish) and not
'first_weekday'/'first_workday'. (IMHO the standard is just silly).
The correct algorithm for determining what day to display first in a weekview
goes something like this:
1) Find out what weekday is associated with the date appearing in the second
field of 'week'. This involves doing some kind of lookup of an arbitrary date.
2) move forward in the list of weekdays the amount indicated by 'first_weekday' - 1
Since first_weekday defaults to 1 (which is the value to use for cases I can
think of) the correct value to change is the value of "week".
However, I have yet to find information about how all this information is
exposed to userspace (outside of libc). Does anyone have pointers?
With RHL9 I get
$ LC_ALL=sv_SE locale first_weekday
$ LC_ALL=sv_SE locale first_workday
I assume I can close the bug now, right?
Yes. Confirmed. Thanks.
Just an interesting observation about the values of those LC_TIME fields:
week-1stday is 19971130 (a Sunday) except for de_DE and en_US where it is
19971201 (a Monday)
week-1stweek is 0 except for de_DE and en_US where it is 4
first_weekday/first_workday is 1 except for sv_SE and bg_BG where it is 2 and
fa_IR where it is 7
It seems de_DE and en_US roughly tries to implement ISO/IEC TR 14652
(http://anubis.dkuug.dk/jtc1/sc22/wg20/docs/n972-14652ft.pdf), but that document
also specifies that the first day of the "day" field should be dictated by the
week field (which maps to week-1stday in glibc naming).
I can only concluded that this is a mess, and that it will be long before the
locale field values can be trusted, see also bug 56657 and bug 56513.
The technical report marks LC_TIME as "controversial". Agreed :)
Martin, was your comment supposed to go into bug 56657 instead?
Fixed in current release.