How to Stop Date Picker Date change while using Google Translator

Stop Date Picker Date change while using Google Translator

 

In the Website, when  changing the language from English to other Language like swedish, chinese or any other language, the Date picker value is changing & showing like NaN/NaN/NaN.

But, the Datepicker format is mm/dd/yyyy

Solution:

For, these we have to find the Date picker container where date i showing. Then find the below classes added in that container,

ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all

Then Add a new class with them, “notranslate”

ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all notranslate

If Google find this class in the container, Google will not translate the content of the container.

keyword “notranslate” will prevent your calendar to translate.

We, can add class using this function, like

$(function() {
    $(".datepicker").datepicker();
    $('.ui-datepicker').addClass('notranslate');
});

 

If you like our post, Please Comment & share.