Bugzilla – Attachment 92105 Details for
Bug 22272
Calendar: When entering date ranges grey out dates in the past from the start date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22272: Calendar: When entering date ranges grey out dates in the past from the start date
Bug-22272-Calendar-When-entering-date-ranges-grey-.patch (text/plain), 5.26 KB, created by
Katrin Fischer
on 2019-08-09 07:14:12 UTC
(
hide
)
Description:
Bug 22272: Calendar: When entering date ranges grey out dates in the past from the start date
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2019-08-09 07:14:12 UTC
Size:
5.26 KB
patch
obsolete
>From 7cfe505e808a192ea4dcfbcb879ba5c4c7515fdc Mon Sep 17 00:00:00 2001 >From: Emmi <emmi.takkinen@outlook.com> >Date: Wed, 10 Jul 2019 09:25:43 +0300 >Subject: [PATCH] Bug 22272: Calendar: When entering date ranges grey out dates > in the past from the start date > >In "Calendar" tool it's possible to pick dates before start >date as end date. > >This patch sets end date calendars "minDate" as picked start day >to grey out past dates. Also reindents datepicker code for >better readability. > >Test plan: >- Apply this patch >- Set start date from first calendar >- Set end date from second calendar >=> Dates before start date are greyed out > >Signed-off-by: Nadine Pierre <nadine.pierre@inLibro.com> >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../prog/en/modules/tools/holidays.tt | 61 +++++++++++----------- > 1 file changed, 31 insertions(+), 30 deletions(-) > >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 8ba0d6d60c..f7771c0953 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >@@ -516,43 +516,44 @@ td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl > $(this).parent().find(".hint").toggle(); return false; > }); > $("#dateofrange").datepicker({ >- beforeShow: function() { >- var startdate = $("#jcalendar-container").datepicker("getDate"); >- if (startdate !== null) { >- var sd = new Date(startdate); >- var ed = new Date($(this).datepicker("getDate")); >- if (ed < sd) { >- $(this).datepicker("setDate", startdate); >- $(this).datepicker("option", "defaultDate", startdate); >- } >+ beforeShow: function() { >+ var startdate = $("#jcalendar-container").datepicker("getDate"); >+ if (startdate !== null) { >+ var sd = new Date(startdate); >+ var ed = new Date($(this).datepicker("getDate")); >+ if (ed < sd) { >+ $(this).datepicker("setDate", startdate); >+ $(this).datepicker("option", "defaultDate", startdate); >+ } >+ } > } >- } > }); > $("#datecancelrange").datepicker(); > $("#dateofrange").each(function () { this.value = "" }); > $("#datecancelrange").each(function () { this.value = "" }); > $("#jcalendar-container").datepicker({ >- beforeShowDay: function(thedate) { >- var day = thedate.getDate(); >- var month = thedate.getMonth() + 1; >- var year = thedate.getFullYear(); >- var dateString = year + '/' + month + '/' + day; >- return dateStatusHandler(dateString); >+ beforeShowDay: function(thedate) { >+ var day = thedate.getDate(); >+ var month = thedate.getMonth() + 1; >+ var year = thedate.getFullYear(); >+ var dateString = year + '/' + month + '/' + day; >+ return dateStatusHandler(dateString); > }, >- onSelect: function(dateText, inst) { >- dateChanged($(this).datepicker("getDate")); >- var enddate = $("#dateofrange").datepicker("getDate"); >- $("#dateofrange").datepicker("option", "defaultDate", $(this).datepicker("getDate")); >- if (enddate !== null) { >- var ed = new Date(enddate); >- var sd = new Date($(this).datepicker("getDate")); >- if (ed < sd) { >- $("#dateofrange").datepicker("setDate", $(this).datepicker("getDate")); >- $("#dateofrange").datepicker("option", "defaultDate", enddate); >- } >- } >- }, >- defaultDate: new Date("[% keydate | html %]") >+ onSelect: function(dateText, inst) { >+ dateChanged($(this).datepicker("getDate")); >+ var enddate = $("#dateofrange").datepicker("getDate"); >+ $("#dateofrange").datepicker("option", "defaultDate", $(this).datepicker("getDate")); >+ $("#dateofrange").datepicker( "option", "minDate", $(this).datepicker("getDate")); //ensure end date can't be before start date >+ if (enddate !== null) { >+ var ed = new Date(enddate); >+ var sd = new Date($(this).datepicker("getDate")); >+ if (ed < sd) { >+ $("#dateofrange").datepicker("setDate", $(this).datepicker("getDate")); >+ $("#dateofrange").datepicker("option", "defaultDate", enddate); >+ } >+ } >+ }, >+ defaultDate: new Date("[% keydate | html %]") > }); > $(".hidePanel").on("click",function(){ > if( $(this).hasClass("showHoliday") ){ >-- >2.11.0
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 22272
:
91456
|
91722
|
91839
| 92105