Bugzilla – Attachment 127919 Details for
Bug 29500
Flatpickr accepting original date in the past for futuredate but also other dates in the past
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29500: Flatpickr - accept original date in the past and not others
Bug-29500-Flatpickr---accept-original-date-in-the-.patch (text/plain), 2.04 KB, created by
Martin Renvoize (ashimema)
on 2021-11-22 10:23:31 UTC
(
hide
)
Description:
Bug 29500: Flatpickr - accept original date in the past and not others
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-11-22 10:23:31 UTC
Size:
2.04 KB
patch
obsolete
>From f075a625284a2e60d8af3c3a3d8b448021e4c5c1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 17 Nov 2021 11:22:57 +0100 >Subject: [PATCH] Bug 29500: Flatpickr - accept original date in the past and > not others > >Bug 29241 was supposed to fix this but it didn't properly. >We are accepting other dates in the past when we should only accept the >original one (the one from the DB) AND dates in future. > >Test plan: >Retry test plan for 29241 and confirm that you cannot set manually another >date in the past. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../intranet-tmpl/prog/en/includes/calendar.inc | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >index 8489c25aca..eebb7ff699 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >@@ -90,8 +90,20 @@ > let options = {}; > > if( $(this).data("flatpickr-futuredate") === true ) { >- options['minDate'] = new Date().fp_incr(1); >- options['allowInvalidPreload'] = true; >+ let original_date = $(this).val(); >+ if ( original_date ) { >+ original_date = Date_from_syspref( original_date ).getTime(); >+ let tomorrow = new Date().fp_incr(1).getTime(); >+ >+ options['enable'] = [function(date){ >+ date = date.getTime(); >+ if ( date == original_date ) return true; >+ if ( date >= tomorrow) return true; >+ }]; >+ } >+ else { >+ options['minDate'] = new Date().fp_incr(1); >+ } > } > if( $(this).data("flatpickr-pastinclusive") === true ) { > options['maxDate'] = "today"; >-- >2.20.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 29500
:
127710
|
127720
|
127803
| 127919