Bugzilla – Attachment 126268 Details for
Bug 29241
Flatpickr not displaying date in the past for futuredate
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29241: Use allowInvalidPreload to allow date in the past
Bug-29241-Use-allowInvalidPreload-to-allow-date-in.patch (text/plain), 2.03 KB, created by
Jonathan Druart
on 2021-10-14 11:07:27 UTC
(
hide
)
Description:
Bug 29241: Use allowInvalidPreload to allow date in the past
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-10-14 11:07:27 UTC
Size:
2.03 KB
patch
obsolete
>From 77ebd19d8f961c71299b885450a0724e7e5ce6f7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 14 Oct 2021 11:36:02 +0200 >Subject: [PATCH] Bug 29241: Use allowInvalidPreload to allow date in the past > >--- > .../prog/en/includes/calendar.inc | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >index aef5938d8e1..1ac51c872ce 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >@@ -31,12 +31,6 @@ > }, > onReady: function( selectedDates, dateStr, instance ){ > /* When flatpickr instance is created, automatically append a "clear date" link */ >- if( $(instance.input).hasClass("futuredate") ){ >- instance.set("minDate", new Date().fp_incr(1)); >- } >- if( $(instance.input).hasClass("pastdate") ){ >- instance.set("maxDate", new Date().fp_incr(-1)); >- } > $(instance.input) > /* Add a wrapper element so that we can prevent the clear button from wrapping */ > .wrap("<span class='flatpickr_wrapper'></span>") >@@ -62,7 +56,18 @@ > }, > }); > $(document).ready(function(){ >- $(".flatpickr").flatpickr(); >+ $(".flatpickr").each(function(){ >+ let options = {}; >+ >+ if( $(this).hasClass("futuredate") ) { >+ options['minDate'] = new Date().fp_incr(1); >+ options['allowInvalidPreload'] = true; >+ } >+ if( $(this).hasClass("pastdate") ) { >+ options['maxDate'] = new Date().fp_incr(-1); >+ } >+ $(this).flatpickr(options); >+ }); > var startPicker = $(".flatpickrfrom").flatpickr({ > onClose: function( selectedDates, dateText, instance) { > validate_date( selectedDates, instance ); >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29241
:
126260
|
126268
|
126473
|
126674
|
126795