hello. i have a qustion that maybe has a very simple answer but i’m a beginner in working with scripts and i couldn’t find it.
i have this code:
function update_livraredetalii() {
var dd = $('#livare-data').val();
dd = Date.fromString(dd);
var oraazi = new Date().getHours();//0--23
var ziazi = new Date().getDay();//0--6, 0 dum
if (dd.getDayOfYear() == today.getDayOfYear() && oraazi >=12) {
$('#li1').hide();$('#li4').hide();$('#li5').hide();
$('#li2').show();
$('#li3').show();
$('#livare-interval').val($('#li2').html());
} else {
$('#li1').show();
$('#li2').show();
$('#li3').show();
$('#li4').show();
$('#li5').hide();
}
dd = dd.asStringFmt('yyyy-mm-dd');
$('#livraredetalii').val(dd+" "+$('#livare-interval').val());
}
$(function(){
today = new Date();today.setHours(0);today.setMinutes(0);today.setSeconds(0);today.setMilliseconds(0);
var oraazi = new Date().getHours();//0--23
var ziazi = new Date().getDay();//0--6, 0 dum
var msecsInADay = 86400000;
firstday = today;
if (ziazi == 0 || (ziazi != 6 && oraazi >= 16) ) { if it's sunday after 4PM
firstday = new Date(today.getTime()+msecsInADay);
} else
if (ziazi == 6 && oraazi >= 10) {//if it's saturday after 10AM
firstday = new Date(today.getTime()+2*msecsInADay); //next day is monday
} else
if (zonaclasa != 0) {
firstday = new Date(today.getTime()+msecsInADay);$('#li4').hide();
} else
if (oraazi >= 9) { //if it's after 9 PM hide the intervals 1 and 4
$('#li1').hide();$('#li4').hide();
$('#li2').show();$('#li3').show();
}
<#if mag.hasText("setup.inchideazi")>
firstday = new Date(today.getTime()+msecsInADay);
</#if>
<#if mag.hasText("setup.inchidemaine")>
firstday = new Date(today.getTime()+2*msecsInADay);
</#if>
Date.format = 'dd-mmm-yyyy';
$('.date-picker').datePicker({
clickInput:true,
showYearNavigation:false,
createButton:false,
renderCallback:function($td,thisDate,month,year) {
if (thisDate.getDay() == 0 || thisDate.getDayOfYear() < firstday.getDayOfYear()) { //ascundem default toate zilele pana la firstday si duminicile
$td.addClass('disabled');
}
}
}).val(firstday.asString())
.trigger('change');
so i have 5 time intervals but the thing that i couldn’t do is to make that for saturdays to show only the 5th interval and hide the other ones.
i’ve tried adding something like this
if (ziazi == 6) {
$('#li1').hide();
$('#li2').hide();
$('#li3').hide();
$('#li4').hide();
$('#li5').show();
}
but it didn’t work
does anyone have any idea.
Thank you