Skip to content

Commit

Permalink
Remove datepicker and replace with flatpickr
Browse files Browse the repository at this point in the history
  • Loading branch information
ricofreak committed Jan 12, 2023
1 parent f94a36c commit fbe9328
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 74 deletions.
16 changes: 1 addition & 15 deletions Koha/Plugin/Com/MarywoodUniversity/RoomReservations/bookas.tt
Original file line number Diff line number Diff line change
Expand Up @@ -379,20 +379,6 @@
$(".datefield").prop("readOnly", true);
});

// http://jqueryui.com/demos/datepicker/#date-range
var requestdates = $( "#availability-search-start-date, #availability-search-end-date" ).datepicker({
minDate: 0,
changeMonth: true,
numberOfMonths: 1,
onSelect: function( selectedDate ) {
var option = this.id == "availability-search-start-date" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" );
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
requestdates.not( this ).datepicker("option", option, date);
}
});
var requestdates = $( "#availability-search-start-date, #availability-search-end-date" ).flatpickr({});
// ]]>
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -944,37 +944,10 @@


if (max_days === "") {
// http://jqueryui.com/demos/datepicker/#date-range
var requestdates = $( "#availability-search-start-date, #availability-search-end-date" ).datepicker({
minDate: 0,
changeMonth: true,
numberOfMonths: 1,
onSelect: function( selectedDate ) {
var option = this.id == "availability-search-start-date" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" );
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
requestdates.not( this ).datepicker("option", option, date);
}
});
var requestdates = $( "#availability-search-start-date, #availability-search-end-date" ).flatpickr({});
} else {
// http://jqueryui.com/demos/datepicker/#date-range
var requestdates = $( "#availability-search-start-date, #availability-search-end-date" ).datepicker({
minDate: 0,
var requestdates = $( "#availability-search-start-date, #availability-search-end-date" ).flatpickr({
maxDate: "+" + max_days + "D",
changeMonth: true,
numberOfMonths: 1,
onSelect: function( selectedDate ) {
var option = this.id == "availability-search-start-date" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" );
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
requestdates.not( this ).datepicker("option", option, date);
}
});
}
// ]]>
Expand Down
32 changes: 2 additions & 30 deletions Koha/Plugin/Com/MarywoodUniversity/RoomReservations/tool.tt
Original file line number Diff line number Diff line change
Expand Up @@ -655,21 +655,7 @@
$(".datefield").prop("readOnly", true);
});

// http://jqueryui.com/demos/datepicker/#date-range
var requestdates = $( "#blackout-start-date, #blackout-end-date" ).datepicker({
minDate: 0,
changeMonth: true,
numberOfMonths: 1,
onSelect: function( selectedDate ) {
var option = this.id == "blackout-start-date" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" );
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
requestdates.not( this ).datepicker("option", option, date);
}
});
var requestdates = $( "#blackout-start-date, #blackout-end-date" ).flatpickr({});
// ]]>
</script>

Expand All @@ -681,21 +667,7 @@
$(".datefield").prop("readOnly", true);
});

// http://jqueryui.com/demos/datepicker/#date-range
var requestdates = $( "#blackout-date" ).datepicker({
minDate: 0,
changeMonth: true,
numberOfMonths: 1,
onSelect: function( selectedDate ) {
var option = this.id == "blackout-date" ? "minDate" : "maxDate",
instance = $( this ).data( "datepicker" );
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
requestdates.not( this ).datepicker("option", option, date);
}
});
var requestdates = $( "#blackout-date" ).flatpickr({});
// ]]>
</script>
[% INCLUDE 'intranet-bottom.inc' %]

0 comments on commit fbe9328

Please sign in to comment.