Closed Bug 2035045 Opened 3 months ago Closed 4 days ago

[Datepicker] Can't set the max day on mobile.

Categories

(Firefox for Android :: General, defect)

Firefox 150
defect

Tracking

()

RESOLVED FIXED
156 Branch
Tracking Status
relnote-firefox --- 156+
firefox156 --- fixed

People

(Reporter: gueux+mozilla, Assigned: corentin)

References

Details

(Whiteboard: [fxdroid] [android-activation-trust] )

Attachments

(3 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:149.0) Gecko/20100101 Firefox/149.0
Firefox for Android

Steps to reproduce:

Using input of type="date" with a max field, I try to set the date to the max with the datepicker on mobile (note that there is no problem on desktop). For example on
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/date#try_it I'd like to set the date to 2018-12-31.

Actual results:

2018-12-31 is not selectable, only 2018-12-30 and before. I also tried to set it manually with the pencil, but 31/12/2018 is "outside of limits" ("Hors limite: 31 déc. 2018" in my French locale).

Expected results:

I should be able to set the date to the max.

The problem appears (at least) on 149 and 150, and only on mobile.

The Bugbug bot thinks this bug should belong to the 'Firefox for Android::General' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → General
Product: Firefox → Firefox for Android
Severity: -- → S2
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → cbect
Status: NEW → ASSIGNED

MaterialDatePicker represents its dates in UTC milliseconds and asks its validator about each day as midnight UTC. DateValidatorPointForward.from() and DateValidatorPointBackward.before() need to use the same UTC representation. The min and max dates were passed in the device timezone instead, so each bound was a moment in time rather than a day.

As a consequence:

  • The max day was greyed out in timezones ahead of UTC
  • The min day was greyed out in timezones behind UTC
  • The min day was greyed out in every timezone when the min date had a time of day

toLocalDayStartAsUtcMillis() drops the time of day rather than shifting it by the offset and returns midnight UTC on that day. For max="2018-12-31" in Paris, the Date is 2018-12-30T23:00Z. toLocalDayStartAsUtcMillis() reads this date as 2018-12-31 in Parisand returns 2018-12-31T00:00Z. Before this change, this max date would remain 2018-12-30T23:00Z, making 2018-12-31 an invalid date on the calendar.

Attachment #9626302 - Attachment description: WIP: Bug 2035045 - Convert the date picker min and max dates to midnight UTC → Bug 2035045 - Convert the date picker min and max dates to midnight UTC
Pushed by lmccracken@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a43defbbe84c https://hg.mozilla.org/integration/autoland/rev/c0367a804c44 Convert the date picker min and max dates to midnight UTC r=android-reviewers,lmccracken
Status: ASSIGNED → RESOLVED
Closed: 4 days ago
Resolution: --- → FIXED
Target Milestone: --- → 156 Branch

Did you want to nominate this for the Fx156 relnotes? If so, set the relnote-firefox flag to "?"
https://wiki.mozilla.org/Release_Management/Release_Notes_Nomination

Possible wording:

Fixed the date picker ignoring the last selectable day when a page set a maximum date.

Flags: needinfo?(cbect)
Whiteboard: [fxdroid] [android-activation-trust]

[Tracking Requested - why for this release]: Fixed an issue where the date picker could prevent selecting the minimum or maximum allowed date.

Flags: needinfo?(cbect)

Thanks Donal!

Thanks, moved the tracking to a release note request

Added to the Fx156 nightly release notes, please allow 30 minutes for the site to update.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: