Jump to content

jquery datepicket not working on mobile


Recommended Posts


My datepicker code is the following:

jQuery( “#start-date” ).datepicker({
dateFormat: ‘dd-mm-yy’,
defaultDate: new Date(),
beforeShowDay: function(date){
var startDate = jQuery.datepicker.formatDate(‘yy-mm-dd’, new Date());
var currentDate = jQuery.datepicker.formatDate(‘yy-mm-dd’, date);
return [ currentDate >= startDate]

This works with IOS but not with android.

If i add the following code to fix positioning:

beforeShow: function (input, inst) {
var rect = input.getBoundingClientRect();
setTimeout(function () {
inst.dpDiv.css({ top: rect.top -40, left: rect.left + 0 });
}, 0);

Then it works with Android but not with IOS.

This code exists in a wordpress site and the problem happened when i upgraded from 5.5 to 5.7

Any ideas how to fix this problem?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...