Closed Bug 516796 Opened 16 years ago Closed 2 years ago

xul:datepicker : the locale default first day of week is always override

Categories

(Toolkit :: UI Widgets, defect)

x86
Windows XP
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: sylvain.spinelli, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729) XPCOMViewer/0.9a Build Identifier: Firefox 3.5.3 In French, the first day of week is Monday, not Sunday. Theorically, the datepicker widget behavior depend on a Locale dtd entity "firstdayofweek.default" defined in "global/datetimepicker.dtd". But the JS code always override this default value due to a bug. Reproducible: Always Steps to Reproduce: 1. If you not used a French locale, edit the locale file global/datetimepicker.dtd 2. Set 1 to the firstdayofweek.default entity 3. Launch Firefox and test : data:application/vnd.mozilla.xul+xml,<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><datepicker type="grid"/></window> Actual Results: The first day of week is Sunday (0), not Monday (1) Expected Results: The first day should be Monday = 1 At http://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/datetimepicker.xml#958 the _weekStart field is well inited : <field name="_weekStart">&firstdayofweek.default;</field> But, here : http://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/datetimepicker.xml#1003 the _weekStart is ALWAYS overide because Number(null) or Number("") return always 0 and not NaN. To correct it, you can change : var fdow = Number(this.getAttribute("firstdayofweek")); with: var fdow = parseInt(this.getAttribute("firstdayofweek")); Then, if "firstdayofweek" attribute is not defined, parseInt(null) return NaN and the following test will be correct : if (!isNaN(fdow) && fdow >= 0 && fdow <= 6)
Component: XUL → XUL Widgets
Product: Core → Toolkit
Version: unspecified → Trunk
Tip : to get round this bug, and get the locale default first day of week, you can set "NaN" in the datepicker firstdayofweek attribute : <xul:datepicker firstdayofweek="NaN"/>
QA Contact: xptoolkit.widgets → xul.widgets
The same thing happens to me using Finnish locale. The month name and the day names are correct, but the first day of the week is Sunday, which is wrong.
I think it's pretty darn amazing that this bug was first filed almost eight years ago, with a complete analysis of the issue and an obvious, one-line fix included in the initial bug report, and it's still not fixed. Truth be told, it's one of many datepicker and timepicker bugs that have stagnated and been ignored for years and years. Truly pitiful.
Severity: normal → S3

There is no XUL Date Picker anymore.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.