-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatefier.js
More file actions
executable file
·59 lines (54 loc) · 1.26 KB
/
datefier.js
File metadata and controls
executable file
·59 lines (54 loc) · 1.26 KB
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
/**
* Set the date picker.
*/
$(function() {
$( ".datepicker" ).each(function(){
$(this).datepicker({
defaultDate: new Date(),
changeMonth: true,
changeYear: true,
numberOfMonths: 1,
});
});
/**
* Set date to be lower than ".to" element and greater than ".from" element *
*/
$(".from" ).each(function(index){
$(this).datepicker("option",{
onClose: function( selectedDate ) {
$( ".to" ).eq(index).datepicker( "option", "minDate", selectedDate );
}
});
});
$(".to" ).each(function(index){
$( this ).datepicker("option",{
onClose: function( selectedDate ) {
$( ".from" ).eq(index).datepicker( "option", "maxDate", selectedDate );
}
});
});
/**
* Set tomorrow as the minimum selectable date
*/
$(".gt-today").each(function(){
$(this).datepicker("option", "minDate", +1);
});
/**
* Set today as the minimum selectable date
*/
$(".gte-today").each(function(){
$(this).datepicker("option", "minDate", 0);
});
/**
* Set yesterday as the maximum selectable date
*/
$(".lw-today").each(function(){
$(this).datepicker("option", "maxDate", -1);
});
/**
* Set today as the maximum selectable date
*/
$(".lwe-today").each(function(){
$(this).datepicker("option", "maxDate", 0);
});
});