dayfilter

git-svn-id: file:///root/webif/svn/pkg/webif/trunk@2395 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2015-04-14 21:15:20 +00:00
parent 1d6d1c972c
commit c54dd07563

View File

@ -363,12 +363,26 @@ $('#mrform input.time').timepicker({
step:5 step:5
}); });
function dayfilter(date)
{
var cur = $('#mrrepeat').val();
if (cur < 3) return [1, ""];
var day = date.getDay();
if (cur == 3) // Weekdays only
return [(day > 0 && day < 6), ""];
else // Weekends only
return [day == 0 || day >= 6, ""];
}
$('#mrsdate').datepicker({ $('#mrsdate').datepicker({
firstDay: 1,
defaultDate: 0, defaultDate: 0,
minDate: 0, minDate: 0,
maxDate: "+1Y", maxDate: "+1Y",
dateFormat: "D, dd/mm/yy", dateFormat: "D, dd/mm/yy",
autoclose: true, autoclose: true,
beforeShowDay: dayfilter,
onClose: function(s) { onClose: function(s) {
var dat = $(this).datepicker('getDate'); var dat = $(this).datepicker('getDate');
if (dat) if (dat)
@ -381,11 +395,17 @@ $('#mrsdate').datepicker({
}); });
$('#mredate').datepicker({ $('#mredate').datepicker({
firstDay: 1,
defaultDate: 0, defaultDate: 0,
minDate: 0, minDate: 0,
maxDate: "+1Y", maxDate: "+1Y",
autoclose: true, autoclose: true,
dateFormat: "D, dd/mm/yy", dateFormat: "D, dd/mm/yy",
beforeShowDay: dayfilter
});
$('#mrrepeat').on('change', function() {
$('#mrform input.date').datepicker('refresh');
}); });
$('#mrform').datepair({ $('#mrform').datepair({