Bugzilla – Attachment 139460 Details for
Bug 30718
Use flatpickr's altInput option everywhere
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30718: Fix time display
Bug-30718-Fix-time-display.patch (text/plain), 13.12 KB, created by
Marcel de Rooy
on 2022-08-19 09:44:39 UTC
(
hide
)
Description:
Bug 30718: Fix time display
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-08-19 09:44:39 UTC
Size:
13.12 KB
patch
obsolete
>From 4aa01bb09ad0a0f573c73be55cbf79b7f4cd49a3 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 19 Jul 2022 14:23:10 +0200 >Subject: [PATCH] Bug 30718: Fix time display >Content-Type: text/plain; charset=utf-8 > >Especifically when timeformat=12h > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../intranet-tmpl/prog/en/includes/calendar.inc | 3 ++- > .../prog/en/includes/checkouts-table-footer.inc | 4 ++-- > .../prog/en/modules/circ/circulation.tt | 8 ++++---- > .../intranet-tmpl/prog/en/modules/circ/offline.tt | 10 +--------- > .../prog/en/modules/tools/holidays.tt | 14 +++++++------- > .../prog/en/modules/tools/import_borrowers.tt | 7 ++++++- > .../intranet-tmpl/prog/js/pages/circulation.js | 14 -------------- > 7 files changed, 22 insertions(+), 38 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >index fee544a1dc..1f83d0ca58 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc >@@ -157,7 +157,8 @@ > } > if ( $(this).data('flatpickr-enable-time') === true ) { > options['enableTime'] = true; >- options['dateFormat'] = flatpickr_dateformat_string + " " + flatpickr_timeformat_string; >+ options['dateFormat'] = "Y-m-d H:i"; >+ options['altFormat'] = flatpickr_dateformat_string + " " + flatpickr_timeformat_string; > } > > let fp = $(this).flatpickr(options); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc >index bede364104..c12c14a631 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc >@@ -10,8 +10,8 @@ > <td colspan="3"> > [% END %] > <div class="date-select"> >- <p><label for="newduedate">Renewal due date:</label> <input type="text" size="20" id="newduedate" name="newduedate" value="" /></p> >- <p id="newonholdduedate"><label for="newonholdduedate">On hold due date:</label> <input type="text" size="20" name="newonholdduedate" value="" /></p> >+ <p><label for="newduedate">Renewal due date:</label> <input type="text" size="20" id="newduedate" name="newduedate" value="" class="flatpickr" data-flatpickr-enable-time="true"/></p> >+ <p id="newonholdduedate"><label for="newonholdduedate">On hold due date:</label> <input type="text" size="20" name="newonholdduedate" value="" class="flatpickr" data-flatpickr-enable-time="true" /></p> > <p><label for="exemptfine">Forgive fines on return:</label> <input type="checkbox" id="exemptfine" name="exemptfine" value="1" /></p> > </div> > </td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 44614d73e8..e194dfc3d5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -317,7 +317,7 @@ > > [% IF ( INVALID_DATE ) %] > <p> >- <input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | $KohaDates with_hours => 1 %]" /> >+ <input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | html %]" class="flatpickr" data-flatpickr-enable-time="true" data-flatpickr-on-close-focus="#barcode" /> > <label for="duedatespec">Due date</label> > </p> > [% ELSE %] >@@ -680,9 +680,9 @@ > <div id="specify-due-date" class="circ-setting"> > <div class="hint">Specify due date [% INCLUDE 'date-format.inc' %]: </div> > [% IF ( duedatespec ) %] >- <input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | html %]" /> >+ <input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | html %]" class="flatpickr" data-flatpickr-enable-time="true" data-flatpickr-on-close-focus="#barcode" /> > [% ELSE %] >- <input type="text" size="20" id="duedatespec" name="duedatespec" value="" /> >+ <input type="text" size="20" id="duedatespec" name="duedatespec" value="" class="flatpickr" data-flatpickr-enable-time="true" data-flatpickr-on-close-focus="#barcode" /> > [% END %] > <label for="stickyduedate"> Remember for session:</label> > [% IF ( stickyduedate ) %] >@@ -747,7 +747,7 @@ > [% IF noissues %] > <div class="onsite-checkout-only"> > <input type="checkbox" id="onsite_checkout" name="onsite_checkout_forced" checked="checked" disabled="disabled" /> <label for="onsite_checkout">On-site checkouts only. Automatic due date: </label> >- <input type="text" name="duedatespec" id="duedatespec" /> >+ <input type="text" name="duedatespec" id="duedatespec" class="flatpickr" data-flatpickr-enable-time="true" data-flatpickr-on-close-focus="#barcode" /> > <input type="hidden" name="onsite_checkout" checked="checked" value="1" /> > </div> > [% ELSE %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt >index 3dd818a33d..efc2277f2f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt >@@ -140,7 +140,7 @@ > > <div class="date-select"> > <div class="hint">Specify due date [% INCLUDE 'date-format.inc' %]: </div> >- <input type="text" size="13" id="duedatespec" name="duedatespec" value="[% duedatespec | html %]" /> >+ <input type="text" size="13" id="duedatespec" name="duedatespec" value="[% duedatespec | html %]" class="flatpickr" data-flatpickr-enable-time="true" data-flatpickr-on-close-focus="#checkout-barcode" /> > <label for="stickyduedate"> Remember for session:</label> > <input type="checkbox" id="stickyduedate" onclick="this.form.barcode.focus();" name="stickyduedate" checked="checked" /> > <input type="button" class="action" id="cleardate" value="Clear" name="cleardate" onclick="this.checked = false; this.form.duedatespec.value = ''; this.form.stickyduedate.checked = false; this.form.barcode.focus(); return false;" /> >@@ -772,14 +772,6 @@ > recordFine($('#pay-fine-amount').val()); > }); > >- $("#duedatespec").flatpickr({ >- enableTime: true, >- dateFormat: flatpickr_datetime_string, >- onClose: function() { >- $("#checkout-barcode").focus(); >- } >- }); >- > $('#mainform').submit(function (event) { > event.preventDefault(); > var barcode = $('#checkout-barcode').val(); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >index a187980c43..86d581fb95 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >@@ -72,7 +72,7 @@ > </li> > <li class="dateinsert"> > <strong>To date: </strong> >- <input type="text" id="datecancelrange" name="datecancelrange" size="20" value="[% datecancelrange | html %]" /> >+ <input type="text" id="datecancelrange" name="datecancelrange" size="20" value="[% datecancelrange | html %]" class="flatpickr" /> > </li> > <li> > <label for="showTitle">Title: </label><input type="text" name="showTitle" id="showTitle" size="35" /> >@@ -170,7 +170,7 @@ > </li> > <li class="dateinsert"> > <strong>To date: </strong> >- <input type="text" id="dateofrange" name="dateofrange" size="20" value="[% dateofrange | html %]" /> >+ <input type="text" id="dateofrange" name="dateofrange" size="20" value="[% dateofrange | html %]" class="flatpickr" /> > </li> > <li> > <label for="title">Title: </label> >@@ -602,17 +602,17 @@ > $(this).parent().find(".hint").toggle(); return false; > }); > >- var dateofrange = $("#dateofrange").flatpickr(); >- >- var datecancelrange = $("#datecancelrange").flatpickr(); >+ const dateofrange = document.querySelector("#dateofrange")._flatpickr; >+ const datecancelrange = document.querySelector("#datecancelrange")._flatpickr; > > $("#dateofrange").each(function () { this.value = "" }); > $("#datecancelrange").each(function () { this.value = "" }); > > var maincalendar = $("#calendar-anchor").flatpickr({ > inline: true, >- onReady: function(){ >- return; >+ onReady: function( selectedDates, dateStr, instance ){ >+ // We do not want to display the 'close' icon in this case >+ $(instance.input).siblings('.flatpickr-input').hide(); > }, > onDayCreate: function( dObj, dStr, fp, dayElem ){ > /* for each day on the calendar, get the >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >index 6603e78aa0..d553b6c647 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >@@ -418,7 +418,12 @@ you can supply dates in ISO format (e.g., '2010-10-28'). > <script> > $(document).ready(function() { > [%# Make date fields have the datepicker %] >- $("#dateenrolled, #dateexpiry, #dateofbirth").flatpickr(); >+ $("#dateenrolled, #dateexpiry, #dateofbirth").flatpickr({ >+ altInput: true, >+ altFormat: flatpickr_dateformat_string, >+ altInputClass: 'flatpickr-input', >+ dateFormat: "Y-m-d", >+ }); > > $(".expand_defaults").click(function(e){ > e.preventDefault(); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js >index 6769d2e74e..db8576f442 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js >@@ -1,4 +1,3 @@ >-/* global flatpickr_dateformat_string flatpickr_timeformat_string */ > $(document).ready(function() { > $("#CheckAllExports").on("click",function(){ > $(".export:visible").prop("checked", true); >@@ -29,19 +28,6 @@ $(document).ready(function() { > radioCheckBox($(this)); > }); > >- $("#duedatespec").flatpickr({ >- enableTime: true, >- dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string, >- onClose: function() { >- $("#barcode").focus(); >- } >- }); >- >- $("#newduedate, #newonholdduedate input").flatpickr({ >- enableTime: true, >- dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string, >- }); >- > $(".clear_date").on("click", function(){ > $("#stickyduedate").prop( "checked", false ); > }); >-- >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 30718
:
135487
|
137516
|
137707
|
137715
|
137803
|
137804
|
137805
|
137806
|
137807
|
137868
|
137869
|
138644
|
138645
|
138646
|
138647
|
138648
|
138649
|
138650
|
138651
|
138652
|
138658
|
138659
|
138748
|
138749
|
138750
|
138751
|
138752
|
138753
|
138754
|
138755
|
138756
|
138757
|
138758
|
138879
|
138980
|
139033
|
139073
|
139074
|
139075
|
139076
|
139077
|
139078
|
139079
|
139080
|
139081
|
139082
|
139083
|
139084
|
139085
|
139453
|
139454
|
139455
|
139456
|
139457
|
139458
|
139459
| 139460 |
139461
|
139462
|
139463
|
139464
|
139465
|
139466
|
139467
|
139468
|
139490
|
139605
|
143175