function highs_val(dz,ss) { ss = ss/1000; highs = 0; overlap_zz(ss,dz,1585108800,1585713600) if (hold_zz > 0 ) { highs = highs + 1;; } 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 } }