WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
225639
[iOS] HTML datepicker's min-max attribute not working
https://bugs.webkit.org/show_bug.cgi?id=225639
Summary
[iOS] HTML datepicker's min-max attribute not working
Kalpeshkumar Jain
Reported
2021-05-11 00:12:04 PDT
Using html input type date in the hybrid application launches the native datepicker in the app. At certain instances the date selection should be restricted till present date only. We have used the max attribute to achieve this feature, however for some reasons the datepicker does not respect this attribute and allows the User to select future dates. Below is the markup to replicate the behavior: <form> <label for="dob">Choose your date of birth:</label> <input type="date" name="dob" id="dob" max="2017-04-30" /> </form> Expected Behavior: User should not be allowed to select future dates. Actual Behavior: User can select future dates.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-05-18 00:13:17 PDT
<
rdar://problem/78142509
>
Ahmad Saleem
Comment 2
2023-05-31 14:54:59 PDT
I changed the test from
Comment 0
in below JSFiddle:
https://jsfiddle.net/dkju3a5g/
I am unable to select 'future' date as expected behavior even in Safari 16.5. I think we can mark this as 'RESOLVED CONFIGURATION CHANGED'. Just wanted to get another opinion so will CC - Aditya & Karl to reconfirm my testing.
Aditya Keerthi
Comment 3
2023-05-31 15:50:36 PDT
This is still relevant on iOS.
Karl Dubost
Comment 4
2023-05-31 20:01:45 PDT
* macOS is working well and enforcing the max date * iOS still doesn't enforce the max date
Darryl Pogue
Comment 5
2024-04-20 16:36:05 PDT
This seems to be due to the iOS date picker being a custom implementation through WKContentViewInteraction rather than implementing a WebDateTimePicker through the page client. My guess is because the iOS implementation predates the refactoring done to bring this to desktop platforms like macOS and GTK.
https://github.com/WebKit/WebKit/blob/e004ae642c29d20e9684279124065f07a98883fb/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm#L990-L995
WKContentViewInteraction sets up the WKDateTimeInputControl based on the focusedElementInformation, which does not contain the min/max values. WebDateTimePicker is meant to get called with WebCore::DateTimeChooserParameters that provides all the values needed to set up the picker correctly. To further complicate the situation, the iOS side also has some special case handling for date/time pickers on watchOS that use a different UI library.
Haroen Viaene
Comment 6
2024-07-22 10:51:17 PDT
I'd like to add that the macOS implementation does indeed not allow people to select a value outside of the range, visually it's impossible to see which is a valid date and which isn't.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug