timepicker element ignores locale specific configuration, e.g. 24h clocks

RESOLVED FIXED

Status

()

Core
XP Toolkit/Widgets: XUL
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: George, Assigned: Neil Deakin (not available until Aug 9))

Tracking

({regression})

2.0 Branch
regression
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

6 years ago
User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b13pre) Gecko/20110227 Firefox/4.0b13pre
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0b13pre) Gecko/20110227 Firefox/4.0b13pre

In Firefox 3, timepicker would use the time format (12 or 24 hour) as defined by OS long time. In Firefox 4, it always uses 12 hour time.

Reproducible: Always
(Reporter)

Updated

6 years ago
Component: XUL → XP Toolkit/Widgets: XUL
QA Contact: xptoolkit.widgets → xptoolkit.xul

Comment 1

6 years ago
The is24HourClock field is specified as readonly:
http://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/datetimepicker.xml#249

But the field is only initialized in |_init|, which then fails:
http://mxr.mozilla.org/mozilla-central/source/toolkit/content/widgets/datetimepicker.xml#508

XBL seems to have implemented readonly fields in moz-2, hence the regression.
This regression is not limited to 24h clocks, but all locale specific runtime configuration (see workaround below).

CC'ing Neil, as he wrote the code it seems.

As a work-around, one might re-bind <timepicker> against the following binding that strips away the readonly stuff:
<binding id="timepicker" extends="chrome://global/content/bindings/datetimepicker.xml#timepicker">
  <implementation>
    <field name="is24HourClock">false</field>
    <field name="hourLeadingZero">false</field>
    <field name="minuteLeadingZero">true</field>
    <field name="secondLeadingZero">true</field>
    <field name="amIndicator">"AM"</field>
    <field name="pmIndicator">"PM"</field>
  </implementation>
</binding>
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
OS: Windows 7 → All
Hardware: x86 → All
Summary: Minefield: timepicker element always uses 12 hour time, even in 24 hour time locales → timepicker element ignores locale specific configuration, e.g. 24h clocks
Version: unspecified → 2.0 Branch
Created attachment 536044 [details] [diff] [review]
Suppose we should remove the readonly flag for now
Assignee: nobody → enndeakin
Status: NEW → ASSIGNED
Attachment #536044 - Flags: review?
Attachment #536044 - Flags: review? → review?(neil)

Comment 3

6 years ago
(In reply to comment #1)
> XBL seems to have implemented readonly fields in moz-2, hence the regression.
That would have been bug 542406.

Updated

6 years ago
Attachment #536044 - Flags: review?(neil) → review+

Comment 4

6 years ago
Comment on attachment 536044 [details] [diff] [review]
Suppose we should remove the readonly flag for now

Review of attachment 536044 [details] [diff] [review]:
-----------------------------------------------------------------

You didn't ask me for review, but r- from me anyway ;)

::: toolkit/content/tests/widgets/test_timepicker.xul
@@ +43,5 @@
>    tp.value = testtag_gettimestring(thour, tminute, tsecond);
>    testtag_comparetime(tp, testid + "set value", thour, tminute, tsecond);
>  
> +  var fdt = new Date(2000,0,1,16,7,9).toLocaleFormat("%X");
> +  is(tp.is24HourClock, Number(fdt) > 12, "is24HourClock");

This test is broken, and will fail on an is24HourClock machine, and only by accident succeed otherwise.
Number("16:07:09") is NaN
Created attachment 536101 [details] [diff] [review]
fix test

OK thanks! I guess I should be more careful with copying text.
Attachment #536101 - Flags: review?(MaierMan)

Updated

6 years ago
Attachment #536101 - Flags: review?(MaierMan) → review+
Keywords: checkin-needed
Keywords: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/50103c9579b0
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Flags: in-testsuite+
Resolution: --- → FIXED

Comment 7

5 years ago
Not clear to me: Is there a fix?

Using TB 11.0.1 doesn't work with 
<timepicker id="timePickerCurrent" hideseconds="true" is24HourClock="false" />
to see 11:05pm instead of 23:05.
You need to log in before you can comment on or make changes to this bug.