Implement the strategy we have in #1252178: Add Modernizr to core for date inputs.

Comments

Parts of the patch from #501428-50: Date and time field type in core. Parts of it are missing apparently, wasn't too careful during the extraction of this changes.

StatusFileSize
new6.83 KB

That patch is missing things, it's more like this.

StatusFileSize
new7.4 KB

Actually that's still missing things, it's this.

Status:Postponed» Active

Marking this active since #1252178: Add Modernizr to core is pending!

And #1252178: Add Modernizr to core is committed! I'm not quite sure how to implement this, I'm hoping someone can provide a patch or example.

I can certainly help with the Modernizr part! Since this looks to be mainly JavaScript changes, you can access the relevant test by writing a conditional like so:

if (Modernizr.inputtypes.date) {
  // Rely on native support
}
else {
  // Summon the polyfill!
}

Or if you only want to cover the NOT:

if (!Modernizr.inputtypes.date) {
  // Polyfill code
}

You can see the full list of support within your browser by going to your browser's JS console and evaluating Modernizr.inputtypes. It will return an Object full of booleans corresponding to each test result. Here's the output I got from Chrome 23.0.1271.64 on OSX:

> Modernizr.inputtypes
  Object
    color: true
    date: true
    datetime: false
    datetime-local: false
    email: true
    month: false
    number: true
    range: true
    search: true
    tel: true
    time: true
    url: true
    week: false

Also coming from there. I've been maintaining Date Popup Authored, which was borne out of that issue, for d6 and d7, but all it really does is replace the Authored On textfield element with (contrib) Date's date_popup element (plus a few extra things to ensure Drupal gets the correct input).

Looks like this pretty much obsoletes the module for D8, am I right?

Splitting the authored on field into HTML5 date and time elements is covered in #501428: Date and time field type in core. If the polyfill is added we'll also have a fallback to the jQuery datepicker. So yes, I think this will obsolete the Date Popup Authored module.

Component:javascript» datetime.module
Issue tags:+JavaScript, +html5, +polyfill

Issue summary:View changes
Priority:Normal» Major
Status:Active» Needs review
StatusFileSize
new21.43 KB
new7.88 KB

Hm. I think this (or another issue that covers this) might be major, or possibly critical...

Here's what a datetime field looks like on Chrome:

Lovely date picker

So far, so good...

But here's what it looks like in Firefox:

Two blank textfields

There's absolutely no guidance about what to do until you submit the form and get an error message. :(

Also, since there's a patch here, marking needs review.

Status:Needs review» Needs work
Related issues:+#2088383: Datetime FAPI DX

This should user Modernizr for feature detection.

And see #2088383: Datetime FAPI DX for the whole date input thing.

(and yay for collapsed text format!)

Parent issue:» #501428: Date and time field type in core