troubleshooting Question

Date input localization problem

Avatar of Member_2_7965240
Member_2_7965240 asked on
* SafariSoftwareWeb ApplicationsPHPFirefox
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
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros