function minimum(dz,ss) { ss = ss/1000; has_mins = 'no'; if (lang == "english") {lang = "eng";} if (lang == "spanish") {lang = "span";} overlap_zz(ss,dz,1512450000,1512882000) if (hold_zz > 0) {has_mins ='yes'} //FIND IF ANY MINIMUMS EXIST if (hold_zz > 0 && (dz < 3)) { texteng = "On these dates there is a minimum booking requirement of 3 nights."; textspan = "En estas fechas el minimo de noches es 3"; if (lang == "eng") {text = texteng} if (lang == "span") {text = textspan} error_code = "minstay_error"; swal({ title: "Error!", text: text, type: "error", confirmButtonText: "OK" }); return false; } function overlap_zz(ss,dz,hsdate,hedate) { //window.alert(+ss+'ss'+dz+'ss'+hsdate+'ss'+hedate) durms = dz*86400; se = ss + durms; hs = hsdate; he = hedate; //holiday end is midnight of last holiday day, i.e. beginning of next day; so, add a day //he = he + 86400; holms = 0; if (ss < hs && se > hs && se < he ) {holms = se - hs ;} if (ss > hs && se > he && ss < he ) {holms = he - ss ;} if (ss >= hs && se <= he ) {holms = durms ;} if (ss <= hs && se >= he ) {holms = he - hs ;} //hold is holidaydays hold_zz = 0; hold_zz = Math.round(holms/86400); return hold_zz } }