From 0e9d07d22cadd51ecaa6372543ad707ae94c004d Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Sat, 16 Nov 2013 10:02:09 -0500 Subject: [PATCH] CRM-13781 limit date selection in calendar widget --- templates/CRM/common/jcalendar.tpl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/templates/CRM/common/jcalendar.tpl b/templates/CRM/common/jcalendar.tpl index e9b2f80ec3..98b67ed168 100644 --- a/templates/CRM/common/jcalendar.tpl +++ b/templates/CRM/common/jcalendar.tpl @@ -103,6 +103,9 @@ yearRange += currentYear + parseInt( cj( alt_field ).attr('endOffset' ) ); {literal} + var startRangeYr = currentYear - parseInt( cj( alt_field ).attr('startOffset') ); + var endRangeYr = currentYear + parseInt( cj( alt_field ).attr('endOffset' ) ); + var lcMessage = {/literal}"{$config->lcMessages}"{literal}; var localisation = lcMessage.split('_'); var dateValue = cj(alt_field).val( ); @@ -114,7 +117,9 @@ altField : alt_field, altFormat : altDateFormat, yearRange : yearRange, - regional : localisation[0] + regional : localisation[0], + minDate : new Date(startRangeYr, 1 - 1, 1), + maxDate : new Date(endRangeYr, 12 - 1, 31) }); // set default value to display field, setDefault param for datepicker -- 2.25.1