Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Date input localization problem

Avatar of Member_2_7965240
Member_2_7965240 asked on
SoftwarePHPFirefox* SafariWeb Applications
3 Comments1 Solution257 ViewsLast Modified:
In our web based software there is a date input which works well in Chrome, Edge and Opera according to localization, but it doesn't work in Firefox and Safari.

As a workaround we built the Modernizr extension like this:
<script>
    $(function(){          
        if (!Modernizr.inputtypes.date) {
            $('input[type=date]').datepicker({
                  dateFormat : 'yy-mm-dd'
                }
             );
        }
    });
</script>

The date shows well with the default value e.g. 2017-11-02 but when the user clicks in it the format changes and it sets a new date (1902 jan. 2).

I attached the pictures

default_value.jpg = Default value
on_focus.jpg = Clicked
after_focus_click.jpg = when it loses focus, without changing the value
on_focus.jpg
after_focus_click.jpg
default_value.jpg