Rectangle 27 0

javascript HTML 5 input type=“date” not working in Firefox?


  • The firefox browser doesn't provide full support for html5 but most of the features are supported on versions above 30.
  • The more convenient was is to use the jquery or bootstrap datetimepicker for selecting date.It will be supported on all browser types.

False. I have Firefox 38, and it does not support input type dates.

Have you opened that link ? Firefox is completely red. Red means it isn't supporting it.

Second confirmation: Firefox 38 does not support this input type as "date"

What version of firefox you are using.Firefox lower versions less than 30 will not support most of html5 features and html5 input type="date" is not supported on firefox. For more details please refer:http://caniuse.com/#feat=input-datetime.

Note
Rectangle 27 0

javascript HTML 5 input type=“date” not working in Firefox?


Note
Rectangle 27 0

javascript HTML 5 input type=“date” not working in Firefox?


about:config
dom.forms.datetype
Note
Rectangle 27 0

javascript HTML 5 input type=“date” not working in Firefox?


<input type="date"/>
<script>
    $(function(){           
        if (!Modernizr.inputtypes.date) {
        // If not native HTML5 support, fallback to jQuery datePicker
            $('input[type=date]').datepicker({
                // Consistent format with the HTML5 picker
                    dateFormat : 'yy-mm-dd'
                },
                // Localization
                $.datepicker.regional['it']
            );
        }
    });
</script>
  • always use a Javascript datetime picker, or
  • check if the browser is supporting that tag, if yes use it, if no then fallback on a javascript datepicker (jQuery or some other one).

A great and simple way to handle older and non-supportive browsers! +1

It uses jQuery because I use jQuery, but you are free to substitute the jQuery parts with vanilla javascript, and the datepicker part with a javascript datepicker of your choice.

Pur that script in a common fragment imported in every page, you should have some...

Sorry this question is coming at this time, but how do you call this javascript function from your html code??

This is a kick off example to do that on every <input type="date"/> element of every page automatically:

Using always a javascript datepicker is easier and faster but it won't work with javascript disabled (who cares), it will work very bad on mobile (this is important) and it will smell of old.

Using the hybrid approach instead will let you cover every case now, up to the day when every browser will support the HTML5 datepicker, in a standardized way and without needing javascript at all. It is future-proof, and this is especially important in mobile browsing, where the javascript datepickers are almost unusable.

You have two options:

Note
Rectangle 27 0

javascript HTML 5 input type=“date” not working in Firefox?


I use 6 HTML selectboxes, for the various items, with OPTION statements for the proper values:

No Javascript needed, although I do use some to avoid invalid selections (like February 30). This is triggered on change of month or year.

year 2000-2050 (or whatever range you choose) month 1-12 (you can have it show month names) day 1-31 hour 0-23 (or use 12 midnight - 11 PM, this just changes the display) minute 0-59 second 0-59 (or just assume 0)

Note