Closed Bug 1756211 Opened 3 years ago Closed 2 years ago

Time input using 24h does not change AM/PM

Categories

(Core :: Layout: Form Controls, enhancement)

Firefox 97
enhancement

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: brian, Assigned: av, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug)

Attachments

(2 files, 3 obsolete files)

Attached file time.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15

Steps to reproduce:

I have an <input type="time" value="01:00" /> field and my system is set to 12h time. The input displays "01:00 AM", as expected. If I type "16" into the hours field, it correctly updates to "04" (since 4pm is the equivalent of 16:00), but the meridiem remains at AM.

User Agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:97.0) Gecko/20100101 Firefox/97.0"

Actual results:

I typed "16" into the hours field and the resulting display is "04:00 AM". It got the hour conversion right, but not the meridiem.

Expected results:

The meridiem should update to PM. Typing "16" into the hours field should result in a display of "04:00 PM".

Note: I wouldn't expect the reverse to happen. If the field is "02:00 PM" and I type "5", it shouldn't become 5am. But typing an hour value greater than 12 should trigger a meridiem shift.

The Bugbug bot thinks this bug should belong to the 'Core::Layout: Form Controls' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Layout: Form Controls
Product: Firefox → Core

This is the relevant code: https://searchfox.org/mozilla-central/rev/a7d4b256719357f3f5cf89b30285d8a53f4e5d98/toolkit/content/widgets/datetimebox.js#1184-1197

That should presumably also call this.setDayPeriodValue(this.mPMIndicator).

Mentor: emilio
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: good-first-bug

Hi there,

Would it be alright if I worked on this bug?

I was made aware that bugs are auto-assigned once a patch is submitted, and it is not usually required to ask to be assigned to one. I will submit a proposed patch for this. I look forward to feedback on the code. Thanks.

Depends on D142760

Assignee: nobody → av
Status: NEW → ASSIGNED

Depends on D142776

Attachment #9271414 - Attachment is obsolete: true

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:av, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit auto_nag documentation.

Flags: needinfo?(kpatenio)
Flags: needinfo?(av)

Patch is waiting on questions from me. Sorry!

Flags: needinfo?(kpatenio)
Flags: needinfo?(emilio)
Flags: needinfo?(av)
Flags: needinfo?(emilio)

This good-first-bug hasn't had any activity for 2 months, it is automatically unassigned.
For more information, please visit auto_nag documentation.

Assignee: av → nobody
Status: ASSIGNED → NEW

The contributor originally assigned to this bug expressed interest in continuing their patch

Assignee: nobody → av

Depends on D142776

Attachment #9293024 - Attachment is obsolete: true

Depends on D142776

Attachment #9293027 - Attachment is obsolete: true
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2df8f5336e36
Time input using 24h does not change AM/PM. r=kpatenio,niklas,emilio
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/autoland/rev/d213da5f7906
Follow-up: fix indentation of new tests. DONTBUILD
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
Regressions: 1798347
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: