Closed Bug 1778086 Opened 3 years ago Closed 1 year ago

Input type date with min max set opens datepicker at current month, if min max in current year.

Categories

(Toolkit :: UI Widgets, defect)

Firefox 102
defect

Tracking

()

RESOLVED FIXED
134 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox-esr102 --- wontfix
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox103 --- wontfix
firefox104 --- wontfix
firefox105 --- wontfix
firefox106 --- wontfix
firefox107 --- wontfix
firefox132 --- wontfix
firefox133 --- wontfix
firefox134 --- fixed

People

(Reporter: matrim20, Assigned: jfkthame)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files, 1 obsolete file)

Attached image Datepicker UI.png

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0

Steps to reproduce:

Opens always in current month:
<input type="date" min="2022-04-05" max="2022-04-08">
Opens in corrent month:
<input type="date" min="2021-04-05" max="2021-04-08">

Tested on date 2022-07-05.

Presumed reason: If intended year equals current year, the datepicker UI always uses the current month, instead of the intended month.

Actual results:

First line opens the datepicker displaying July 2022.
Second line opens the datepicker displaying April 2021.

Attached screenshot displays the current state.

Expected results:

First line opens the datepicker displaying April 2022.
Second line opens the datepicker displaying April 2021.

(In comparison: Chrome 103 opens both in the correct month)

I've managed to reproduce this issue on the latest versions Nightly 105.0a1 and Firefox 103.0.1 on Windows 10 x64.
Setting this to NEW. If this is not the correct component, please feel free to change it to a more appropriate one.

Narrowed down the regression range to:

Last good revision: bfbef2b417a1bfd26a4ce3b5d1f062d8266edb91
First bad revision: 8262d23cdf85c12d77ab69eaf56feba6c76c36d8
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=bfbef2b417a1bfd26a4ce3b5d1f062d8266edb91&tochange=8262d23cdf85c12d77ab69eaf56feba6c76c36d8

Severity: -- → S4
Status: UNCONFIRMED → NEW
Has STR: --- → yes
Component: Untriaged → XUL Widgets
Ever confirmed: true
Product: Firefox → Toolkit
Regressed by: 1728366
Severity: S4 → S3

https://searchfox.org/mozilla-central/source/toolkit/content/widgets/datekeeper.js#107 doesn't look right to me.
Maybe we should just change the line to
selectedMonth = Math.min(Math.max(month, minMonth), maxMonth);

Set release status flags based on info from the regressing bug 1728366

(In reply to Hsin-Yi Tsai (she/her) [:hsinyi] from comment #2)

https://searchfox.org/mozilla-central/source/toolkit/content/widgets/datekeeper.js#107 doesn't look right to me.
Maybe we should just change the line to
selectedMonth = Math.min(Math.max(month, minMonth), maxMonth);

Mark, it seems that we have a clue about the root of the problem, could you help find an owner? Thanks

Flags: needinfo?(mstriemer)
Flags: needinfo?(mstriemer)
See Also: → 1708159
See Also: 1708159
Flags: needinfo?(mstriemer)
Assignee: nobody → mstriemer
Status: NEW → ASSIGNED

Thanks Hsin-Yi, that worked well!

Flags: needinfo?(mstriemer)
Pushed by mstriemer@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fe7c0cde6cb6 Default to valid month in datepicker with current year range r=mconley

Backed out changeset fe7c0cde6cb6 (Bug 1778086) for causing bc failures on browser_datetime_datepicker.js.
Backout link
Push with failures <--> bc3
Failure Log

Flags: needinfo?(mstriemer)

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:mstriemer, 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?(mstriemer)
Flags: needinfo?(mconley)

Clearing review request - I suspect mstriemer will get to this when he gets to this.

Flags: needinfo?(mconley)

Someone should fix this... it's annoying to have to make hack-y workarround to solve this problem. This issue does not occur on any of the other major browsers.

Duplicate of this bug: 1929103

:mstriemer, I ran across this and have taken the liberty of stealing your patch and (I hope) fixing up the issue that resulted in test failures last time (comment 8). I'll post the updated version for your review.

(Updated version of mstriemer's patch in D159725.)

Attachment #9299279 - Attachment is obsolete: true
Assignee: mstriemer → jfkthame
Flags: needinfo?(mstriemer)
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/956988c98ea6 Default to valid month in datepicker with current year range. r=mstriemer,reusable-components-reviewers,emilio
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 134 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: