Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if Browser Supports HTML5 timepicker

I built a time mask in JavaScript which works great for PC's, Macs, iPhones, and iPads, but doesn't work consistently in most Android phones (I'd prefer not to get into the details of why this functionality can't work consistently in Android) so I disable it. For Samsung the built-in HTML5 time picker works great.

For Android phones I would like to leverage the HTML5 time pickers, when native browser time pickers are available (like for modern Samsung phones).

I know I can detect if the browser supports the date/datetime input types, but that doesn't necessarily indicate that the browser supports a time picker (For anyone who doubts this test it with an HTC EVO 3D, as just one example.) This Question ( Detect browser's native date/time pickers ) indicates that the if the time type is supported then the browser has implemented a time picker, but this is wrong.

I'm aware of modernizr but I don't see a way to actually verify if the browser supports a timepicker.

So with that background information. Does anyone know of a way to determine if the browser has implemented a time picker?

like image 616
SemanticZen Avatar asked Nov 04 '22 09:11

SemanticZen


1 Answers

I would argue that the safest bet is actually to assume that <input type="date"> is unsupported. As of today (early 2016), the actual UI for the date picker is still very inconsistent across browsers. Unless you're developing for a very concrete subset of browsers you are going to need some JavaScript anyway.

References:

  • http://html5doctor.com/the-woes-of-date-input
  • http://caniuse.com/#feat=input-datetime
like image 50
rvidal Avatar answered Nov 13 '22 03:11

rvidal