Bug 31261: Introduce flatpickr-futureinclusive
That let us use future + today, and it's working perfectly for our use case :) Sponsored-by: Association KohaLa - https://koha-fr.org/ Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
614b0a5033
commit
20294f52bf
|
|
@ -130,7 +130,8 @@
|
|||
let refresh_max_date = 0;
|
||||
let disable_buttons = [];
|
||||
|
||||
if( $(this).data("flatpickr-futuredate") === true ) {
|
||||
if( $(this).data("flatpickr-futureinclusive") === true
|
||||
|| $(this).data("flatpickr-futuredate") === true ) {
|
||||
let original_date = $(this).val();
|
||||
if ( original_date ) {
|
||||
original_date = Date_from_syspref( original_date ).getTime();
|
||||
|
|
@ -143,10 +144,18 @@
|
|||
}];
|
||||
}
|
||||
else {
|
||||
options['minDate'] = new Date().fp_incr(1);
|
||||
if( $(this).data("flatpickr-futureinclusive") === true ) {
|
||||
options['minDate'] = new Date().setHours(00, 00, 00, 00);
|
||||
} else {
|
||||
options['minDate'] = new Date().fp_incr(1);
|
||||
}
|
||||
}
|
||||
|
||||
disable_buttons.push(0); /* Yesterday */
|
||||
disable_buttons.push(1); /* Today */
|
||||
|
||||
if ( $(this).data("flatpickr-futuredate") === true ) {
|
||||
disable_buttons.push(1); /* Today */
|
||||
}
|
||||
}
|
||||
if( $(this).data("flatpickr-pastinclusive") === true ) {
|
||||
options['maxDate'] = new Date(); /* Not today or hh:mm will be 00:00 */
|
||||
|
|
|
|||
|
|
@ -476,7 +476,7 @@
|
|||
|
||||
<li>
|
||||
<label for="pickup_date">Pickup date: </label>
|
||||
<input id="pickup_date" name="pickup_date" required="required" class="flatpickr" data-flatpickr-futuredate="true" />
|
||||
<input id="pickup_date" name="pickup_date" required="required" class="flatpickr" data-flatpickr-futureinclusive="true" />
|
||||
</li>
|
||||
|
||||
<li id="pickup-times" class="radio"></li>
|
||||
|
|
|
|||
|
|
@ -141,7 +141,8 @@
|
|||
let refresh_max_date = 0;
|
||||
let disable_buttons = [];
|
||||
|
||||
if( $(this).data("flatpickr-futuredate") === true ) {
|
||||
if( $(this).data("flatpickr-futureinclusive") === true
|
||||
|| $(this).data("flatpickr-futuredate") === true ) {
|
||||
let original_date = $(this).val();
|
||||
if ( original_date ) {
|
||||
original_date = Date_from_syspref( original_date ).getTime();
|
||||
|
|
@ -154,10 +155,18 @@
|
|||
}];
|
||||
}
|
||||
else {
|
||||
options['minDate'] = new Date().fp_incr(1);
|
||||
if( $(this).data("flatpickr-futureinclusive") === true ) {
|
||||
options['minDate'] = new Date().setHours(00, 00, 00, 00);
|
||||
} else {
|
||||
options['minDate'] = new Date().fp_incr(1);
|
||||
}
|
||||
}
|
||||
|
||||
disable_buttons.push(0); /* Yesterday */
|
||||
disable_buttons.push(1); /* Today */
|
||||
|
||||
if ( $(this).data("flatpickr-futuredate") === true ) {
|
||||
disable_buttons.push(1); /* Today */
|
||||
}
|
||||
}
|
||||
if( $(this).data("flatpickr-pastinclusive") === true ) {
|
||||
options['maxDate'] = new Date(); /* Not today or hh:mm will be 00:00 */
|
||||
|
|
|
|||
|
|
@ -242,9 +242,9 @@
|
|||
<div class="required_label required">Required</div>
|
||||
</li>
|
||||
<li id="pickup_date_item">
|
||||
<label for="pickup-date">Pickup date:</label>
|
||||
<input name="pickup_date" type="text" class="flatpickr" id="pickup-date" required="required" data-flatpickr-futuredate="true" />
|
||||
<div class="required_label required">Required</div>
|
||||
<label for="pickup_date">Pickup date:</label>
|
||||
<input name="pickup_date" type="text" class="flatpickr" id="pickup-date" required="required" data-flatpickr-futureinclusive="true" />
|
||||
<span class="required">Required</span>
|
||||
</li>
|
||||
|
||||
<li id="pickup-times"></li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue