Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html 5 datepicker in firefox

Is there any way that I can set enable a datepicker in firefox(version 21) with HTML 5. I dont want to use a jQuery based datepicker because javascript will be disabled in the browsers where the website will be used. The datepicker works fine with Chrome.

So if html 5 datepicker is not supported,how can I add a datepicker without jquery ?

like image 997
Aravind Bharathy Avatar asked Jun 25 '13 08:06

Aravind Bharathy


3 Answers

jQuery UI has a datepicker widget that you can conditionally load if the browser doesn't have one built in. The catch is that even if you only select the datepicker widget in a custom jQuery UI build, it's still a significant download.

My favorite solution is to use yepnope, which comes with Modernizr, to conditionally load the jQuery UI CSS and JS files only if needed for the datepicker. By combining this with an optimized build of Modernizr and a datepicker-only jQuery UI build, it gives you the smallest download for all possible browsers.

yepnope({ /* included with Modernizr */
  test : Modernizr.inputtypes.date,
  nope : {
    'css': '/path-to-your-css/jquery-ui-1.10.3.custom.min.css',
    'js': '/path-to-your-js/jquery-ui-1.10.3.datepicker.min.js'
  },
  callback: { // executed once files are loaded
    'js': function() { $('input[type=date]').datepicker({dateFormat: "yy-mm-dd"}); } // default HTML5 format
  }
});
like image 60
Blazemonger Avatar answered Oct 23 '22 08:10

Blazemonger


Firefox 57 (Nov 14, 2017) supports it:

http://caniuse.com/#feat=input-datetime

like image 42
Abel Pastur Avatar answered Oct 23 '22 10:10

Abel Pastur


Old question, but I found this here (firefox 54), at least, which gives hope:

Go to about:config and search for dom.forms.datetime

Set both entries found to true, et voilà! Now all they need to do is enable them by default!

like image 2
Stephanie Peters Avatar answered Oct 23 '22 10:10

Stephanie Peters