/*! * Accessible Datepicker v2.1.19 * Copyright 2015-2019 Eureka2, Jacques Archimède. * Based on the example of the Open AJAX Alliance Accessibility Tools Task Force : http://www.oaa-accessibility.org/examplep/datepicker1/ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Inspired by : * http://wet-boew.github.io/wet-boew/demos/datepicker/datepicker-fr.html * http://eternicode.github.io/bootstrap-datepicker */ (function(){"use strict";if(typeof Date.dp_locales==="undefined"){Date.dp_locales={texts:{buttonTitle:"Select date...",buttonLabel:"Click or press the Enter key or the spacebar to open the calendar",prevButtonLabel:"Go to previous month",prevMonthButtonLabel:"Go to the previous year",prevYearButtonLabel:"Go to the previous twenty years",nextButtonLabel:"Go to next month",nextMonthButtonLabel:"Go to the next year",nextYearButtonLabel:"Go to the next twenty years",changeMonthButtonLabel:"Click or press the Enter key or the spacebar to change the month",changeYearButtonLabel:"Click or press the Enter key or the spacebar to change the year",changeRangeButtonLabel:"Click or press the Enter key or the spacebar to go to the next twenty years",closeButtonTitle:"Close",closeButtonLabel:"Close the calendar",calendarHelp:"- Up Arrow and Down Arrow - goes to the same day of the week in the previous or next week respectively. If the end of the month is reached, continues into the next or previous month as appropriate.\r\n- Left Arrow and Right Arrow - advances one day to the next, also in a continuum. Visually focus is moved from day to day and wraps from row to row in the grid of days.\r\n- Control+Page Up - Moves to the same date in the previous year.\r\n- Control+Page Down - Moves to the same date in the next year.\r\n- Home - Moves to the first day of the current month.\r\n- End - Moves to the last day of the current month.\r\n- Page Up - Moves to the same date in the previous month.\r\n- Page Down - Moves to the same date in the next month.\r\n- Enter or Espace - closes the calendar, and the selected date is shown in the associated text box.\r\n- Escape - closes the calendar without any action."},directionality:"LTR",month_names:["January","February","March","April","May","June","July","August","September","October","November","December"],month_names_abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"],month_names_narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],day_names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],day_names_abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],day_names_short:["Su","Mo","Tu","We","Th","Fr","Sa"],day_names_narrow:["S","M","T","W","T","F","S"],day_periods:{am:"AM",noon:"noon",pm:"PM"},day_periods_abbreviated:{am:"AM",noon:"noon",pm:"PM"},day_periods_narrow:{am:"a",noon:"n",pm:"p"},quarter_names:["1st quarter","2nd quarter","3rd quarter","4th quarter"],quarter_names_abbreviated:["Q1","Q2","Q3","Q4"],quarter_names_narrow:["1","2","3","4"],era_names:["Before Christ","Anno Domini"],era_names_abbreviated:["BC","AD"],era_names_narrow:["B","A"],full_format:"EEEE, MMMM d, y",long_format:"MMMM d, y",medium_format:"MMM d, y",short_format:"M/d/yy",firstday_of_week:0}}})();(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else if(typeof exports==="object"){factory(require("jquery"))}else{if(typeof jQuery==="undefined"){throw new Error("Datepicker's JavaScript requires jQuery")}factory(jQuery)}})((function($){"use strict";var GLYPHICONS={calendar:"glyphicon glyphicon-calendar",forward:"glyphicon glyphicon-forward",backward:"glyphicon glyphicon-backward","triangle-right":"glyphicon glyphicon-triangle-right","triangle-left":"glyphicon glyphicon-triangle-left","is-fa":""};var FAICONS={calendar:"far fa-calendar-alt",forward:"fas fa-forward",backward:"fas fa-backward","triangle-right":"fas fa-caret-right","triangle-left":"fas fa-caret-left","is-fa":"use-fa-icons"};const VIEW_DAYS=0,VIEW_MONTHS=1,VIEW_YEARS=2;const helpText='
Page up/down to skip months, Alt + page up/down to skip years
';var datepickerButton3=['','\tSelect Date...',""];var datepickerCalendar3=['"];var datepickerButton4=['','\t',""];var datepickerCalendar4=['"];function replaceIcons(html,iconSet){return html.replace(/{icon-([^}]+)}/g,(function(e,name){return iconSet[name]}))}var Datepicker=function(target,options){var self=this;this.$target=$(target);this.options=$.extend({},Datepicker.DEFAULTS,options);this.log=this.options.loggingEnabled&&window.console&&console.log?console.log.bind(console):function(){};this.log("Initialising Datepicker");this.locales=Date.dp_locales;this.startview(this.options.startView);if(typeof this.options.inputFormat==="string"){this.options.inputFormat=[this.options.inputFormat]}if(!$.isArray(this.options.datesDisabled)){this.options.datesDisabled=[this.options.datesDisabled]}$.each(this.options.datesDisabled,(function(i,v){if(typeof v==="string"){var date=self.parseDate(v);if(date===null){self.options.datesDisabled[i]=null}else{self.options.datesDisabled[i]=self.format(date)}}else if(v instanceof Date&&!isNaN(v.valueOf())){self.options.datesDisabled[i]=self.format(v)}else{self.options.datesDisabled[i]=null}}));if(this.options.min!=null){this.options.min=this.parseDate(this.options.min)}else if(this.$target.attr("min")){this.options.min=this.parseDate(this.$target.attr("min"))}if(this.options.max!=null){this.options.max=this.parseDate(this.options.max)}else if(this.$target.attr("max")){this.options.max=this.parseDate(this.$target.attr("max"))}if(typeof this.options.previous==="string"){this.options.previous=$(this.options.previous)}else if(!(this.options.previous instanceof jQuery)){this.options.previous=null}if(typeof this.options.next==="string"){this.options.next=$(this.options.next)}else if(!(this.options.next instanceof jQuery)){this.options.next=null}this.id=this.$target.attr("id")||"datepicker-"+Math.floor(Math.random()*1e5);this.$linkField=this.options.linkField?$(document.getElementById(this.options.linkField)):null;const needsWrapper=!this.options.button;function specificFaIcons(){return jQuery.extend({},FAICONS,{"fa-edition":self.options.fontAwesomePro?"use-fa-pro":"use-fa-free"})}var iconSet=this.options.fontAwesome||this.options.markup==="bootstrap4"?specificFaIcons():GLYPHICONS;var calendar=this.options.markup=="bootstrap3"?datepickerCalendar3.join(""):datepickerCalendar4.join("");calendar=calendar.replace(/CALENDARID/g,this.id+"");calendar=replaceIcons(calendar,iconSet);if(needsWrapper){if(this.$target.parent(".input-group").length===0){this.$target.wrap('
')}this.$group=this.$target.parent(".input-group")}this.$target.attr("aria-autocomplete","none");this.$target.css("min-width","7em");this.$target.addClass("form-control");if(!this.$target.attr("placeholder")){this.$target.attr("placeholder",this.options.inputFormat[0])}if(options.button){this.$button=$(document.getElementById(options.button));this.$button.attr("aria-haspopup","true").attr("aria-labelledby","datepicker-bn-open-label-"+this.id)}else{var button=this.options.markup=="bootstrap3"?datepickerButton3.join(""):datepickerButton4.join("");button=button.replace(/CALENDARID/g,this.id+"");button=replaceIcons(button,iconSet);this.$button=$(button);this.$button.addClass(this.options.theme);if(this.options.buttonLeft){this.$target.before(this.$button)}else{this.$target.after(this.$button)}}const $offsetFrom=needsWrapper?this.$target.parent():this.$button;this.$calendar=$(calendar);this.$calendar.addClass(this.options.theme);if(this.$calendar.parent().css("position")==="static"){this.$calendar.parent().css("position","relative")}this.$calendar.find(".datepicker-bn-open-label").html(this.options.buttonLabel);if(this.$target.attr("id")){this.$calendar.attr("aria-controls",this.$target.attr("id"))}this.$button.find("span").attr("title",this.options.buttonTitle);this.$calendar.css("left",$offsetFrom.position().left+"px");this.$monthObj=this.$calendar.find(".datepicker-month");this.$prev=this.$calendar.find(".datepicker-month-prev");this.$next=this.$calendar.find(".datepicker-month-next");this.$fastprev=this.$calendar.find(".datepicker-month-fast-prev");this.$fastnext=this.$calendar.find(".datepicker-month-fast-next");this.$grid=this.$calendar.find(".datepicker-grid");if(this.locales.directionality==="RTL"){this.$grid.addClass("rtl")}this.$timeview=this.$calendar.find(".datepicker-time-view");this.drawCalendarHeader();if(this.options.inline==false&&this.options.modal==true){this.$close=this.$calendar.find(".datepicker-close");this.$close.html(this.options.closeButtonTitle).attr("title",this.options.closeButtonLabel);this.$calendar.find(".datepicker-bn-close-label").html(this.options.closeButtonLabel)}else{this.hideObject(this.$calendar.find(".datepicker-close-wrap"));this.hideObject(this.$calendar.find(".datepicker-bn-close-label"))}if(this.options.inline!=false){this.hideObject(this.$button);var $container=typeof this.options.inline==="string"?$(document.getElementById(this.options.inline)):this.options.inline;$container.append(this.$calendar);this.$calendar.css({position:"relative",left:"0px"});this.initializeDate()}else{this.$calendar.css({display:"none"});$offsetFrom.after(this.$calendar);this.hide(!this.options.gainFocusOnConstruction)}this.keys={tab:9,enter:13,esc:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40};this.bindHandlers();this.$button.click((function(e){e.preventDefault();e.stopPropagation();if(!$(this).hasClass("disabled")){if(self.$calendar.attr("aria-hidden")==="true"){self.initializeDate();self.show()}else{self.hide()}if(!self.options.timeOnly){self.selectGridCell(self.$grid.attr("aria-activedescendant"))}}return false}));this.$button.keydown((function(ev){self.keyboardUsed();if(ev.keyCode==self.keys.enter||ev.keyCode==self.keys.space){$(this).trigger("click");return false}}));this.$calendar.on("blur",(function(){if(self.$calendar.attr("aria-hidden")==="false"){self.hide()}}))};Datepicker.VERSION="2.1.19";Datepicker.DEFAULTS={firstDayOfWeek:Date.dp_locales.firstday_of_week,weekDayFormat:"short",startView:VIEW_DAYS,daysOfWeekDisabled:[],datesDisabled:[],timeEnabled:false,timeOnly:false,isDateDisabled:null,isMonthDisabled:null,isYearDisabled:null,linkField:null,linkFormat:"yyyy-MM-dd",inputFormat:[Date.dp_locales.short_format],outputFormat:Date.dp_locales.short_format,titleFormat:Date.dp_locales.full_format,buttonLeft:false,buttonTitle:Date.dp_locales.texts.buttonTitle,buttonLabel:Date.dp_locales.texts.buttonLabel,prevButtonLabel:Date.dp_locales.texts.prevButtonLabel,prevMonthButtonLabel:Date.dp_locales.texts.prevMonthButtonLabel,prevYearButtonLabel:Date.dp_locales.texts.prevYearButtonLabel,nextButtonLabel:Date.dp_locales.texts.nextButtonLabel,nextMonthButtonLabel:Date.dp_locales.texts.nextMonthButtonLabel,nextYearButtonLabel:Date.dp_locales.texts.nextYearButtonLabel,changeMonthButtonLabel:Date.dp_locales.texts.changeMonthButtonLabel,changeYearButtonLabel:Date.dp_locales.texts.changeYearButtonLabel,changeRangeButtonLabel:Date.dp_locales.texts.changeRangeButtonLabel,closeButtonTitle:Date.dp_locales.texts.closeButtonTitle,closeButtonLabel:Date.dp_locales.texts.closeButtonLabel,onUpdate:function(){},previous:null,next:null,allowSameDate:true,markup:"bootstrap3",theme:"default",modal:false,inline:false,gainFocusOnConstruction:true,min:null,max:null,minHour:0,maxHour:23,minuteIncrements:30,fontAwesome:false,fontAwesomePro:false,clientValidation:true};Datepicker.prototype.initializeDate=function(){this.setDate(this.getDate(),true)};Datepicker.prototype.getDate=function(){var val=this.$target.val();var date=val===""?new Date:this.parseDate(val);return date};Datepicker.prototype.setDate=function(newDate,init){this.dateObj=newDate;init=typeof init==="undefined"?false:init;if(this.dateObj==null){this.markHasError(true);this.dateObj=new Date;this.dateObj.setHours(0,0,0,0)}if(this.options.min!=null&&this.dateObjthis.options.max){this.markHasError(true);this.dateObj=this.options.max}if(!init||this.$target.val()!=""){this.$target.val(this.format(this.dateObj))}this.curYear=this.dateObj.getFullYear();this.year=this.curYear;this.curMonth=this.dateObj.getMonth();this.month=this.curMonth;this.date=this.dateObj.getDate();if(this.options.timeEnabled){this.hour=this.dateObj.getHours();this.minute=this.dateObj.getMinutes();this.populateTimePane()}else{this.$timeview.hide()}switch(this.options.startView){case VIEW_MONTHS:this.populateMonthsCalendar();this.$grid.attr("aria-activedescendant",this.$grid.find(".curMonth").attr("id"));break;case VIEW_YEARS:this.populateYearsCalendar();this.$grid.attr("aria-activedescendant",this.$grid.find(".curYear").attr("id"));break;default:this.populateDaysCalendar();this.$grid.attr("aria-activedescendant",this.$grid.find(".curDay").attr("id"))}if(this.options.timeOnly){let $calendarColumn=this.$calendar.find(".datepicker-calendar-column");$calendarColumn.find("[tabindex]").removeAttr("tabindex");$calendarColumn.on("click",(function(e){e.preventDefault();e.stopPropagation();return false}));$calendarColumn.find("[role=button], .datepicker-month").removeClass("enabled").addClass("disabled text-muted");$calendarColumn.find("th").addClass("text-muted");$calendarColumn.find(".selectable").removeClass("selectable").addClass("unselectable")}};Datepicker.prototype.populateTimePane=function(){var h,m,$li;this.log("populateTimePane");this.$timeview.attr("tabindex","-1");var $list=$("