[DateTimePicker] Check if min and max attributes are valid date strings

RESOLVED FIXED in Firefox 56

Status

()

enhancement
P1
normal
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: scottwu, Assigned: scottwu)

Tracking

(Blocks 1 bug)

unspecified
mozilla56
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox56 fixed)

Details

Attachments

(2 attachments)

According to the spec[1], the min and max should be valid date strings, and should be set to empty if they aren't.

Currently, the min and max values are used directly in Date constructor, which is very forgiving and can parse the dates that aren't valid date strings. This causes discrepancy between the input box and the picker.

[1] https://html.spec.whatwg.org/multipage/forms.html#date-state-(type=date)
Priority: -- → P1
Assignee: nobody → scwwu
Status: NEW → ASSIGNED
Rather than re-implementing the date validation method, I exposed the cpp method via webidl. Do you think this approach is okay :jessica?
Flags: needinfo?(jjong)
(In reply to Scott Wu [:scottwu] from comment #4)
> Rather than re-implementing the date validation method, I exposed the cpp
> method via webidl. Do you think this approach is okay :jessica?

I think it's okay as long as it's chrome only. You can just use "ChromeOnly", I don't think XBL code needs it right now.
And maybe "GetMinimum/Maximum" would be more useful?

Please remember that changing .webdil requires review from a DOM peer.
Flags: needinfo?(jjong)
Comment on attachment 8885109 [details]
Bug 1364026 - (Part 2) Check if min and max attributes on input type date are valid date strings.

https://reviewboard.mozilla.org/r/155962/#review162604

Looks good, thanks!
Attachment #8885109 - Flags: review?(mconley) → review+
Comment on attachment 8885108 [details]
Bug 1364026 - (Part 1) Expose HTMLInputElement.getMinimum/getMaximum methods via webidl.

https://reviewboard.mozilla.org/r/155960/#review163096
Attachment #8885108 - Flags: review?(bugs) → review+
Thanks :mconley and :smaug! Checking it in.
Keywords: checkin-needed
(In reply to Scott Wu [:scottwu] from comment #12)
> Comment on attachment 8885109 [details]
> Bug 1364026 - (Part 2) Check if min and max attributes on input type date
> are valid date strings.
> 
> Review request updated; see interdiff:
> https://reviewboard.mozilla.org/r/155962/diff/3-4/

Rebased to central and resolved conflicts.
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/ee20903b5973
(Part 1) Expose HTMLInputElement.getMinimum/getMaximum methods via webidl. r=smaug
https://hg.mozilla.org/integration/autoland/rev/39f99fa53275
(Part 2) Check if min and max attributes on input type date are valid date strings. r=mconley
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/ee20903b5973
https://hg.mozilla.org/mozilla-central/rev/39f99fa53275
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.