-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
66 lines (52 loc) · 1.16 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
$(document).ready(function(){
formReady();
$('.timepicker').timepicker({
timeFormat: 'HH.mm',
interval: 60,
minTime: '4.00',
maxTime: '23.00',
startTime: '4.00',
dynamic: false,
dropdown: false,
scrollbar: false
});
});
function disableDays(date) {
var day = date.getDay();
return[(day == 6)];
}
function formReady() {
var now = new Date();
var day = now.getDay();
var daysToSaturday;
var displayDate;
if (day == 6) {
daysToSaturday = 0;
} else {
daysToSaturday = 6 - day;
}
var daysToNextSaturday = daysToSaturday + 7;
if (daysToSaturday == 0) {
//display next weeks rota
displayDate = daysToNextSaturday;
} else {
//display this weeks rota
displayDate = daysToSaturday;
}
//alert(displayDate);
$(".week_ending").datepicker({
showButtonPanel: true,
dateFormat: 'yy-mm-dd',
beforeShowDay: disableDays}).on('keypress', function(e){ e.preventDefault(); });
$(".week_ending").datepicker().datepicker("setDate", displayDate);
}
$( function() {
$( "#dialog" ).dialog({
modal: true,
buttons: {
Ok: function() {
$( this ).dialog( "close" );
}
}
});
} );