Do not proceed with this change if you are not familiar with PHP and Javascript . This change can generate problems due to new date format and you need to be able to debug your code. The guide is correct and tested with live sites .If you proceed further please understand that we will not be able to review and fix your code. If don’t know how to code please ask someone who can or hire a programmer.

For the advanced search datepicker.

The date format for advanced search can be changed in function check_in_out_enable which is in control.js around line 469.  you have there  code like

jQuery("#" + in_date).datepicker({
dateFormat : "yy-mm-dd",

which can be changed in something like

jQuery("#" + in_date).datepicker({
dateFormat : "dd-mm-yy",

*** please note that there are several places where you should do these change.

However your date format may not be according to Javascript standards (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date). And in this case for this function you may need to convert the “prev_date” argument into in acceptable format. Otherwise the checkout datepicker may not work correctly.

originaly we have

prev_date = new Date(jQuery('#' + in_date).val());

and this need to be replaced into

var stringDate = jQuery('#' + in_date).val();
var myDateArray = stringDate.split("-");
prev_date= new Date(myDateArray[2],myDateArray[1]-1,myDateArray[0]);

For the date picker in booking form

You need to do the same changes like you did in check_in_out_enable function but this time for function check_in_out_enable2 located in control.js around line 548

code should look like

.............................
jQuery("#" + in_date).change(function () {

prev_date = new Date(jQuery('#' + in_date).val());
selected_date = wpestate_get_unix_time(prev_date);

var stringDate = jQuery('#' + in_date).val();
var myDateArray = stringDate.split("-");

prev_date= new Date(myDateArray[2],myDateArray[1]-1,myDateArray[0]);
selected_min_days = wpestate_return_min_days_value(selected_date);

if (selected_min_days>0){
prev_date =wpestate_addDays( prev_date ,selected_min_days-1 );
}else{
prev_date =wpestate_addDays( prev_date,0 );
}

jQuery("#" + out_date).val('');
jQuery("#" + out_date).removeAttr('disabled');
jQuery("#" + out_date).datepicker("destroy");
jQuery("#" + out_date).datepicker({
dateFormat : "dd-mm-yy",
minDate: prev_date,
beforeShowDay:function (date){
return enableAllTheseDays(date, out_date );
}
}, jQuery.datepicker.regional[control_vars.datepick_lang]);

});
..............................

For the date picker in booking form – the “check in date cannot be bigger than Check out date” problem

Since the date format you picked  -(for ex dd-mm-yy) may not be accepted by Javasxript (see above) you need to convert the start and end date for the booking form also. The code is in property.js  around lines 316,326 and 334

jQuery('#booking_form_request_mess').empty().hide();
if(fromdate>todate && todate!=='' ){
jQuery('#booking_form_request_mess').show().empty().append(property_vars.nostart)
jQuery('#show_cost_form').remove();
return;
}

replace that  with this code

  var stringDate = $("#start_date").val();
        var myDateArray = stringDate.split("-");
        var fromdate_check= new Date(myDateArray[2],myDateArray[1]-1,myDateArray[0]);
        var fromdate_unix=Math.floor(fromdate_check.getTime()/1000);
        stringDate = $("#end_date").val();
        myDateArray = stringDate.split("-");
        var todate_check= new Date(myDateArray[2],myDateArray[1]-1,myDateArray[0]);
        var todate_unix=Math.floor(todate_check.getTime()/1000); 
        jQuery('#booking_form_request_mess').empty().hide();
        if(fromdate_unix>todate_unix && todate!=='' ){
        jQuery('#booking_form_request_mess').show().empty().append(property_vars.nostart);
        jQuery('#show_cost_form').remove();
        return;
        }  

And the following edits in console.js (applying for version 2.0.4)


 

function wpestate_UTC_addDays(date, days) {
var myDateArray = date.split("-");
date= new Date(myDateArray[2],myDateArray[1]-1,myDateArray[0]);
var result = new Date(date);
var now_utc = new Date(result.getUTCFullYear(), result.getUTCMonth(), result.getUTCDate(), result.getUTCHours(), result.getUTCMinutes(), result.getUTCSeconds());
var new_day=parseFloat(result.getUTCDate())+1 + parseFloat(days);
now_utc.setDate(new_day);
return now_utc;
}

 

Here are all the comparison code changes applied in control.js for both

“check in date cannot be bigger than Check out date” and date format edits

For all in one calendar – modal window

In js/ajaxcalls_add.js at line 866 you have this function function timeConverter(UNIX_timestamp) {

at the end of the function you have this line

time = year + ‘-‘ + month + ‘-‘ + date;

Here you can edit the way date is displayed on all in one modal window.

See below screenshot where are displayed php files that must be edited to changed calendar date format:

 

 

PHP changes

 

Some date formats may generate problems at the php level. For example this format “April-21-2016”. In this case (and if you are using  the version  1.15.4 or lower)

In help functions function function wpestate_check_booking_valability() use this code
$from_date = DateTime::createFromFormat(‘M-d-Y’, $book_from);

instead of

$from_date          =   new DateTime($book_from);

Do this for the $to_date variable. Also this change may be required in other parts of the theme .

 

For the property page , the custom price list

 

You need to go into listing_functions.php , function wpestate_show_custom_details . See the screenshot to see the see some of the places you need to change.

*** Please note that these change may not be the only ones to switch from a date format to other.

Update for 1.20.4 or later

the valus for prev date needs to be change like in these screencaptures