diff --git a/attract/static/assets/js/vendor/pikaday.js b/attract/static/assets/js/vendor/pikaday.js
index 72fb602..d107c33 100644
--- a/attract/static/assets/js/vendor/pikaday.js
+++ b/attract/static/assets/js/vendor/pikaday.js
@@ -1,1193 +1 @@
-/*!
- * Pikaday
- *
- * Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday
- */
-
-(function (root, factory)
-{
- 'use strict';
-
- var moment;
- if (typeof exports === 'object') {
- // CommonJS module
- // Load moment.js as an optional dependency
- try { moment = require('moment'); } catch (e) {}
- module.exports = factory(moment);
- } else if (typeof define === 'function' && define.amd) {
- // AMD. Register as an anonymous module.
- define(function (req)
- {
- // Load moment.js as an optional dependency
- var id = 'moment';
- try { moment = req(id); } catch (e) {}
- return factory(moment);
- });
- } else {
- root.Pikaday = factory(root.moment);
- }
-}(this, function (moment)
-{
- 'use strict';
-
- /**
- * feature detection and helper functions
- */
- var hasMoment = typeof moment === 'function',
-
- hasEventListeners = !!window.addEventListener,
-
- document = window.document,
-
- sto = window.setTimeout,
-
- addEvent = function(el, e, callback, capture)
- {
- if (hasEventListeners) {
- el.addEventListener(e, callback, !!capture);
- } else {
- el.attachEvent('on' + e, callback);
- }
- },
-
- removeEvent = function(el, e, callback, capture)
- {
- if (hasEventListeners) {
- el.removeEventListener(e, callback, !!capture);
- } else {
- el.detachEvent('on' + e, callback);
- }
- },
-
- fireEvent = function(el, eventName, data)
- {
- var ev;
-
- if (document.createEvent) {
- ev = document.createEvent('HTMLEvents');
- ev.initEvent(eventName, true, false);
- ev = extend(ev, data);
- el.dispatchEvent(ev);
- } else if (document.createEventObject) {
- ev = document.createEventObject();
- ev = extend(ev, data);
- el.fireEvent('on' + eventName, ev);
- }
- },
-
- trim = function(str)
- {
- return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g,'');
- },
-
- hasClass = function(el, cn)
- {
- return (' ' + el.className + ' ').indexOf(' ' + cn + ' ') !== -1;
- },
-
- addClass = function(el, cn)
- {
- if (!hasClass(el, cn)) {
- el.className = (el.className === '') ? cn : el.className + ' ' + cn;
- }
- },
-
- removeClass = function(el, cn)
- {
- el.className = trim((' ' + el.className + ' ').replace(' ' + cn + ' ', ' '));
- },
-
- isArray = function(obj)
- {
- return (/Array/).test(Object.prototype.toString.call(obj));
- },
-
- isDate = function(obj)
- {
- return (/Date/).test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime());
- },
-
- isWeekend = function(date)
- {
- var day = date.getDay();
- return day === 0 || day === 6;
- },
-
- isLeapYear = function(year)
- {
- // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951
- return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
- },
-
- getDaysInMonth = function(year, month)
- {
- return [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
- },
-
- setToStartOfDay = function(date)
- {
- if (isDate(date)) date.setHours(0,0,0,0);
- },
-
- compareDates = function(a,b)
- {
- // weak date comparison (use setToStartOfDay(date) to ensure correct result)
- return a.getTime() === b.getTime();
- },
-
- extend = function(to, from, overwrite)
- {
- var prop, hasProp;
- for (prop in from) {
- hasProp = to[prop] !== undefined;
- if (hasProp && typeof from[prop] === 'object' && from[prop] !== null && from[prop].nodeName === undefined) {
- if (isDate(from[prop])) {
- if (overwrite) {
- to[prop] = new Date(from[prop].getTime());
- }
- }
- else if (isArray(from[prop])) {
- if (overwrite) {
- to[prop] = from[prop].slice(0);
- }
- } else {
- to[prop] = extend({}, from[prop], overwrite);
- }
- } else if (overwrite || !hasProp) {
- to[prop] = from[prop];
- }
- }
- return to;
- },
-
- adjustCalendar = function(calendar) {
- if (calendar.month < 0) {
- calendar.year -= Math.ceil(Math.abs(calendar.month)/12);
- calendar.month += 12;
- }
- if (calendar.month > 11) {
- calendar.year += Math.floor(Math.abs(calendar.month)/12);
- calendar.month -= 12;
- }
- return calendar;
- },
-
- /**
- * defaults and localisation
- */
- defaults = {
-
- // bind the picker to a form field
- field: null,
-
- // automatically show/hide the picker on `field` focus (default `true` if `field` is set)
- bound: undefined,
-
- // position of the datepicker, relative to the field (default to bottom & left)
- // ('bottom' & 'left' keywords are not used, 'top' & 'right' are modifier on the bottom/left position)
- position: 'bottom left',
-
- // automatically fit in the viewport even if it means repositioning from the position option
- reposition: true,
-
- // the default output format for `.toString()` and `field` value
- format: 'YYYY-MM-DD',
-
- // the initial date to view when first opened
- defaultDate: null,
-
- // make the `defaultDate` the initial selected value
- setDefaultDate: false,
-
- // first day of week (0: Sunday, 1: Monday etc)
- firstDay: 0,
-
- // the default flag for moment's strict date parsing
- formatStrict: false,
-
- // the minimum/earliest date that can be selected
- minDate: null,
- // the maximum/latest date that can be selected
- maxDate: null,
-
- // number of years either side, or array of upper/lower range
- yearRange: 10,
-
- // show week numbers at head of row
- showWeekNumber: false,
-
- // used internally (don't config outside)
- minYear: 0,
- maxYear: 9999,
- minMonth: undefined,
- maxMonth: undefined,
-
- startRange: null,
- endRange: null,
-
- isRTL: false,
-
- // Additional text to append to the year in the calendar title
- yearSuffix: '',
-
- // Render the month after year in the calendar title
- showMonthAfterYear: false,
-
- // Render days of the calendar grid that fall in the next or previous month
- showDaysInNextAndPreviousMonths: false,
-
- // how many months are visible
- numberOfMonths: 1,
-
- // when numberOfMonths is used, this will help you to choose where the main calendar will be (default `left`, can be set to `right`)
- // only used for the first display or when a selected date is not visible
- mainCalendar: 'left',
-
- // Specify a DOM element to render the calendar in
- container: undefined,
-
- // internationalization
- i18n: {
- previousMonth : 'Previous Month',
- nextMonth : 'Next Month',
- months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
- weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
- weekdaysShort : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
- },
-
- // Theme Classname
- theme: null,
-
- // callback function
- onSelect: null,
- onOpen: null,
- onClose: null,
- onDraw: null
- },
-
-
- /**
- * templating functions to abstract HTML rendering
- */
- renderDayName = function(opts, day, abbr)
- {
- day += opts.firstDay;
- while (day >= 7) {
- day -= 7;
- }
- return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day];
- },
-
- renderDay = function(opts)
- {
- var arr = [];
- var ariaSelected = 'false';
- if (opts.isEmpty) {
- if (opts.showDaysInNextAndPreviousMonths) {
- arr.push('is-outside-current-month');
- } else {
- return '
| ';
- }
- }
- if (opts.isDisabled) {
- arr.push('is-disabled');
- }
- if (opts.isToday) {
- arr.push('is-today');
- }
- if (opts.isSelected) {
- arr.push('is-selected');
- ariaSelected = 'true';
- }
- if (opts.isInRange) {
- arr.push('is-inrange');
- }
- if (opts.isStartRange) {
- arr.push('is-startrange');
- }
- if (opts.isEndRange) {
- arr.push('is-endrange');
- }
- return '' +
- '' +
- ' | ';
- },
-
- renderWeek = function (d, m, y) {
- // Lifted from http://javascript.about.com/library/blweekyear.htm, lightly modified.
- var onejan = new Date(y, 0, 1),
- weekNum = Math.ceil((((new Date(y, m, d) - onejan) / 86400000) + onejan.getDay()+1)/7);
- return '' + weekNum + ' | ';
- },
-
- renderRow = function(days, isRTL)
- {
- return '' + (isRTL ? days.reverse() : days).join('') + '
';
- },
-
- renderBody = function(rows)
- {
- return '' + rows.join('') + '';
- },
-
- renderHead = function(opts)
- {
- var i, arr = [];
- if (opts.showWeekNumber) {
- arr.push(' | ');
- }
- for (i = 0; i < 7; i++) {
- arr.push('' + renderDayName(opts, i, true) + ' | ');
- }
- return '' + (opts.isRTL ? arr.reverse() : arr).join('') + '
';
- },
-
- renderTitle = function(instance, c, year, month, refYear, randId)
- {
- var i, j, arr,
- opts = instance._o,
- isMinYear = year === opts.minYear,
- isMaxYear = year === opts.maxYear,
- html = '',
- monthHtml,
- yearHtml,
- prev = true,
- next = true;
-
- for (arr = [], i = 0; i < 12; i++) {
- arr.push('
');
- }
-
- monthHtml = '
' + opts.i18n.months[month] + '
';
-
- if (isArray(opts.yearRange)) {
- i = opts.yearRange[0];
- j = opts.yearRange[1] + 1;
- } else {
- i = year - opts.yearRange;
- j = 1 + year + opts.yearRange;
- }
-
- for (arr = []; i < j && i <= opts.maxYear; i++) {
- if (i >= opts.minYear) {
- arr.push('
');
- }
- }
- yearHtml = '
' + year + opts.yearSuffix + '
';
-
- if (opts.showMonthAfterYear) {
- html += yearHtml + monthHtml;
- } else {
- html += monthHtml + yearHtml;
- }
-
- if (isMinYear && (month === 0 || opts.minMonth >= month)) {
- prev = false;
- }
-
- if (isMaxYear && (month === 11 || opts.maxMonth <= month)) {
- next = false;
- }
-
- if (c === 0) {
- html += '
';
- }
- if (c === (instance._o.numberOfMonths - 1) ) {
- html += '
';
- }
-
- return html += '
';
- },
-
- renderTable = function(opts, data, randId)
- {
- return '' + renderHead(opts) + renderBody(data) + '
';
- },
-
-
- /**
- * Pikaday constructor
- */
- Pikaday = function(options)
- {
- var self = this,
- opts = self.config(options);
-
- self._onMouseDown = function(e)
- {
- if (!self._v) {
- return;
- }
- e = e || window.event;
- var target = e.target || e.srcElement;
- if (!target) {
- return;
- }
-
- if (!hasClass(target, 'is-disabled')) {
- if (hasClass(target, 'pika-button') && !hasClass(target, 'is-empty') && !hasClass(target.parentNode, 'is-disabled')) {
- self.setDate(new Date(target.getAttribute('data-pika-year'), target.getAttribute('data-pika-month'), target.getAttribute('data-pika-day')));
- if (opts.bound) {
- sto(function() {
- self.hide();
- if (opts.field) {
- opts.field.blur();
- }
- }, 100);
- }
- }
- else if (hasClass(target, 'pika-prev')) {
- self.prevMonth();
- }
- else if (hasClass(target, 'pika-next')) {
- self.nextMonth();
- }
- }
- if (!hasClass(target, 'pika-select')) {
- // if this is touch event prevent mouse events emulation
- if (e.preventDefault) {
- e.preventDefault();
- } else {
- e.returnValue = false;
- return false;
- }
- } else {
- self._c = true;
- }
- };
-
- self._onChange = function(e)
- {
- e = e || window.event;
- var target = e.target || e.srcElement;
- if (!target) {
- return;
- }
- if (hasClass(target, 'pika-select-month')) {
- self.gotoMonth(target.value);
- }
- else if (hasClass(target, 'pika-select-year')) {
- self.gotoYear(target.value);
- }
- };
-
- self._onKeyChange = function(e)
- {
- e = e || window.event;
-
- if (self.isVisible()) {
-
- switch(e.keyCode){
- case 13:
- case 27:
- opts.field.blur();
- break;
- case 37:
- e.preventDefault();
- self.adjustDate('subtract', 1);
- break;
- case 38:
- self.adjustDate('subtract', 7);
- break;
- case 39:
- self.adjustDate('add', 1);
- break;
- case 40:
- self.adjustDate('add', 7);
- break;
- }
- }
- };
-
- self._onInputChange = function(e)
- {
- var date;
-
- if (e.firedBy === self) {
- return;
- }
- if (hasMoment) {
- date = moment(opts.field.value, opts.format, opts.formatStrict);
- date = (date && date.isValid()) ? date.toDate() : null;
- }
- else {
- date = new Date(Date.parse(opts.field.value));
- }
- if (isDate(date)) {
- self.setDate(date);
- }
- if (!self._v) {
- self.show();
- }
- };
-
- self._onInputFocus = function()
- {
- self.show();
- };
-
- self._onInputClick = function()
- {
- self.show();
- };
-
- self._onInputBlur = function()
- {
- // IE allows pika div to gain focus; catch blur the input field
- var pEl = document.activeElement;
- do {
- if (hasClass(pEl, 'pika-single')) {
- return;
- }
- }
- while ((pEl = pEl.parentNode));
-
- if (!self._c) {
- self._b = sto(function() {
- self.hide();
- }, 50);
- }
- self._c = false;
- };
-
- self._onClick = function(e)
- {
- e = e || window.event;
- var target = e.target || e.srcElement,
- pEl = target;
- if (!target) {
- return;
- }
- if (!hasEventListeners && hasClass(target, 'pika-select')) {
- if (!target.onchange) {
- target.setAttribute('onchange', 'return;');
- addEvent(target, 'change', self._onChange);
- }
- }
- do {
- if (hasClass(pEl, 'pika-single') || pEl === opts.trigger) {
- return;
- }
- }
- while ((pEl = pEl.parentNode));
- if (self._v && target !== opts.trigger && pEl !== opts.trigger) {
- self.hide();
- }
- };
-
- self.el = document.createElement('div');
- self.el.className = 'pika-single' + (opts.isRTL ? ' is-rtl' : '') + (opts.theme ? ' ' + opts.theme : '');
-
- addEvent(self.el, 'mousedown', self._onMouseDown, true);
- addEvent(self.el, 'touchend', self._onMouseDown, true);
- addEvent(self.el, 'change', self._onChange);
- addEvent(document, 'keydown', self._onKeyChange);
-
- if (opts.field) {
- if (opts.container) {
- opts.container.appendChild(self.el);
- } else if (opts.bound) {
- document.body.appendChild(self.el);
- } else {
- opts.field.parentNode.insertBefore(self.el, opts.field.nextSibling);
- }
- addEvent(opts.field, 'change', self._onInputChange);
-
- if (!opts.defaultDate) {
- if (hasMoment && opts.field.value) {
- opts.defaultDate = moment(opts.field.value, opts.format).toDate();
- } else {
- opts.defaultDate = new Date(Date.parse(opts.field.value));
- }
- opts.setDefaultDate = true;
- }
- }
-
- var defDate = opts.defaultDate;
-
- if (isDate(defDate)) {
- if (opts.setDefaultDate) {
- self.setDate(defDate, true);
- } else {
- self.gotoDate(defDate);
- }
- } else {
- self.gotoDate(new Date());
- }
-
- if (opts.bound) {
- this.hide();
- self.el.className += ' is-bound';
- addEvent(opts.trigger, 'click', self._onInputClick);
- addEvent(opts.trigger, 'focus', self._onInputFocus);
- addEvent(opts.trigger, 'blur', self._onInputBlur);
- } else {
- this.show();
- }
- };
-
-
- /**
- * public Pikaday API
- */
- Pikaday.prototype = {
-
-
- /**
- * configure functionality
- */
- config: function(options)
- {
- if (!this._o) {
- this._o = extend({}, defaults, true);
- }
-
- var opts = extend(this._o, options, true);
-
- opts.isRTL = !!opts.isRTL;
-
- opts.field = (opts.field && opts.field.nodeName) ? opts.field : null;
-
- opts.theme = (typeof opts.theme) === 'string' && opts.theme ? opts.theme : null;
-
- opts.bound = !!(opts.bound !== undefined ? opts.field && opts.bound : opts.field);
-
- opts.trigger = (opts.trigger && opts.trigger.nodeName) ? opts.trigger : opts.field;
-
- opts.disableWeekends = !!opts.disableWeekends;
-
- opts.disableDayFn = (typeof opts.disableDayFn) === 'function' ? opts.disableDayFn : null;
-
- var nom = parseInt(opts.numberOfMonths, 10) || 1;
- opts.numberOfMonths = nom > 4 ? 4 : nom;
-
- if (!isDate(opts.minDate)) {
- opts.minDate = false;
- }
- if (!isDate(opts.maxDate)) {
- opts.maxDate = false;
- }
- if ((opts.minDate && opts.maxDate) && opts.maxDate < opts.minDate) {
- opts.maxDate = opts.minDate = false;
- }
- if (opts.minDate) {
- this.setMinDate(opts.minDate);
- }
- if (opts.maxDate) {
- this.setMaxDate(opts.maxDate);
- }
-
- if (isArray(opts.yearRange)) {
- var fallback = new Date().getFullYear() - 10;
- opts.yearRange[0] = parseInt(opts.yearRange[0], 10) || fallback;
- opts.yearRange[1] = parseInt(opts.yearRange[1], 10) || fallback;
- } else {
- opts.yearRange = Math.abs(parseInt(opts.yearRange, 10)) || defaults.yearRange;
- if (opts.yearRange > 100) {
- opts.yearRange = 100;
- }
- }
-
- return opts;
- },
-
- /**
- * return a formatted string of the current selection (using Moment.js if available)
- */
- toString: function(format)
- {
- return !isDate(this._d) ? '' : hasMoment ? moment(this._d).format(format || this._o.format) : this._d.toDateString();
- },
-
- /**
- * return a Moment.js object of the current selection (if available)
- */
- getMoment: function()
- {
- return hasMoment ? moment(this._d) : null;
- },
-
- /**
- * set the current selection from a Moment.js object (if available)
- */
- setMoment: function(date, preventOnSelect)
- {
- if (hasMoment && moment.isMoment(date)) {
- this.setDate(date.toDate(), preventOnSelect);
- }
- },
-
- /**
- * return a Date object of the current selection with fallback for the current date
- */
- getDate: function()
- {
- return isDate(this._d) ? new Date(this._d.getTime()) : new Date();
- },
-
- /**
- * set the current selection
- */
- setDate: function(date, preventOnSelect)
- {
- if (!date) {
- this._d = null;
-
- if (this._o.field) {
- this._o.field.value = '';
- fireEvent(this._o.field, 'change', { firedBy: this });
- }
-
- return this.draw();
- }
- if (typeof date === 'string') {
- date = new Date(Date.parse(date));
- }
- if (!isDate(date)) {
- return;
- }
-
- var min = this._o.minDate,
- max = this._o.maxDate;
-
- if (isDate(min) && date < min) {
- date = min;
- } else if (isDate(max) && date > max) {
- date = max;
- }
-
- this._d = new Date(date.getTime());
- setToStartOfDay(this._d);
- this.gotoDate(this._d);
-
- if (this._o.field) {
- this._o.field.value = this.toString();
- fireEvent(this._o.field, 'change', { firedBy: this });
- }
- if (!preventOnSelect && typeof this._o.onSelect === 'function') {
- this._o.onSelect.call(this, this.getDate());
- }
- },
-
- /**
- * change view to a specific date
- */
- gotoDate: function(date)
- {
- var newCalendar = true;
-
- if (!isDate(date)) {
- return;
- }
-
- if (this.calendars) {
- var firstVisibleDate = new Date(this.calendars[0].year, this.calendars[0].month, 1),
- lastVisibleDate = new Date(this.calendars[this.calendars.length-1].year, this.calendars[this.calendars.length-1].month, 1),
- visibleDate = date.getTime();
- // get the end of the month
- lastVisibleDate.setMonth(lastVisibleDate.getMonth()+1);
- lastVisibleDate.setDate(lastVisibleDate.getDate()-1);
- newCalendar = (visibleDate < firstVisibleDate.getTime() || lastVisibleDate.getTime() < visibleDate);
- }
-
- if (newCalendar) {
- this.calendars = [{
- month: date.getMonth(),
- year: date.getFullYear()
- }];
- if (this._o.mainCalendar === 'right') {
- this.calendars[0].month += 1 - this._o.numberOfMonths;
- }
- }
-
- this.adjustCalendars();
- },
-
- adjustDate: function(sign, days) {
-
- var day = this.getDate();
- var difference = parseInt(days)*24*60*60*1000;
-
- var newDay;
-
- if (sign === 'add') {
- newDay = new Date(day.valueOf() + difference);
- } else if (sign === 'subtract') {
- newDay = new Date(day.valueOf() - difference);
- }
-
- if (hasMoment) {
- if (sign === 'add') {
- newDay = moment(day).add(days, "days").toDate();
- } else if (sign === 'subtract') {
- newDay = moment(day).subtract(days, "days").toDate();
- }
- }
-
- this.setDate(newDay);
- },
-
- adjustCalendars: function() {
- this.calendars[0] = adjustCalendar(this.calendars[0]);
- for (var c = 1; c < this._o.numberOfMonths; c++) {
- this.calendars[c] = adjustCalendar({
- month: this.calendars[0].month + c,
- year: this.calendars[0].year
- });
- }
- this.draw();
- },
-
- gotoToday: function()
- {
- this.gotoDate(new Date());
- },
-
- /**
- * change view to a specific month (zero-index, e.g. 0: January)
- */
- gotoMonth: function(month)
- {
- if (!isNaN(month)) {
- this.calendars[0].month = parseInt(month, 10);
- this.adjustCalendars();
- }
- },
-
- nextMonth: function()
- {
- this.calendars[0].month++;
- this.adjustCalendars();
- },
-
- prevMonth: function()
- {
- this.calendars[0].month--;
- this.adjustCalendars();
- },
-
- /**
- * change view to a specific full year (e.g. "2012")
- */
- gotoYear: function(year)
- {
- if (!isNaN(year)) {
- this.calendars[0].year = parseInt(year, 10);
- this.adjustCalendars();
- }
- },
-
- /**
- * change the minDate
- */
- setMinDate: function(value)
- {
- if(value instanceof Date) {
- setToStartOfDay(value);
- this._o.minDate = value;
- this._o.minYear = value.getFullYear();
- this._o.minMonth = value.getMonth();
- } else {
- this._o.minDate = defaults.minDate;
- this._o.minYear = defaults.minYear;
- this._o.minMonth = defaults.minMonth;
- this._o.startRange = defaults.startRange;
- }
-
- this.draw();
- },
-
- /**
- * change the maxDate
- */
- setMaxDate: function(value)
- {
- if(value instanceof Date) {
- setToStartOfDay(value);
- this._o.maxDate = value;
- this._o.maxYear = value.getFullYear();
- this._o.maxMonth = value.getMonth();
- } else {
- this._o.maxDate = defaults.maxDate;
- this._o.maxYear = defaults.maxYear;
- this._o.maxMonth = defaults.maxMonth;
- this._o.endRange = defaults.endRange;
- }
-
- this.draw();
- },
-
- setStartRange: function(value)
- {
- this._o.startRange = value;
- },
-
- setEndRange: function(value)
- {
- this._o.endRange = value;
- },
-
- /**
- * refresh the HTML
- */
- draw: function(force)
- {
- if (!this._v && !force) {
- return;
- }
- var opts = this._o,
- minYear = opts.minYear,
- maxYear = opts.maxYear,
- minMonth = opts.minMonth,
- maxMonth = opts.maxMonth,
- html = '',
- randId;
-
- if (this._y <= minYear) {
- this._y = minYear;
- if (!isNaN(minMonth) && this._m < minMonth) {
- this._m = minMonth;
- }
- }
- if (this._y >= maxYear) {
- this._y = maxYear;
- if (!isNaN(maxMonth) && this._m > maxMonth) {
- this._m = maxMonth;
- }
- }
-
- randId = 'pika-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2);
-
- for (var c = 0; c < opts.numberOfMonths; c++) {
- html += '' + renderTitle(this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year, randId) + this.render(this.calendars[c].year, this.calendars[c].month, randId) + '
';
- }
-
- this.el.innerHTML = html;
-
- if (opts.bound) {
- if(opts.field.type !== 'hidden') {
- sto(function() {
- opts.trigger.focus();
- }, 1);
- }
- }
-
- if (typeof this._o.onDraw === 'function') {
- this._o.onDraw(this);
- }
-
- if (opts.bound) {
- // let the screen reader user know to use arrow keys
- opts.field.setAttribute('aria-label', 'Use the arrow keys to pick a date');
- }
- },
-
- adjustPosition: function()
- {
- var field, pEl, width, height, viewportWidth, viewportHeight, scrollTop, left, top, clientRect;
-
- if (this._o.container) return;
-
- this.el.style.position = 'absolute';
-
- field = this._o.trigger;
- pEl = field;
- width = this.el.offsetWidth;
- height = this.el.offsetHeight;
- viewportWidth = window.innerWidth || document.documentElement.clientWidth;
- viewportHeight = window.innerHeight || document.documentElement.clientHeight;
- scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
-
- if (typeof field.getBoundingClientRect === 'function') {
- clientRect = field.getBoundingClientRect();
- left = clientRect.left + window.pageXOffset;
- top = clientRect.bottom + window.pageYOffset;
- } else {
- left = pEl.offsetLeft;
- top = pEl.offsetTop + pEl.offsetHeight;
- while((pEl = pEl.offsetParent)) {
- left += pEl.offsetLeft;
- top += pEl.offsetTop;
- }
- }
-
- // default position is bottom & left
- if ((this._o.reposition && left + width > viewportWidth) ||
- (
- this._o.position.indexOf('right') > -1 &&
- left - width + field.offsetWidth > 0
- )
- ) {
- left = left - width + field.offsetWidth;
- }
- if ((this._o.reposition && top + height > viewportHeight + scrollTop) ||
- (
- this._o.position.indexOf('top') > -1 &&
- top - height - field.offsetHeight > 0
- )
- ) {
- top = top - height - field.offsetHeight;
- }
-
- this.el.style.left = left + 'px';
- this.el.style.top = top + 'px';
- },
-
- /**
- * render HTML for a particular month
- */
- render: function(year, month, randId)
- {
- var opts = this._o,
- now = new Date(),
- days = getDaysInMonth(year, month),
- before = new Date(year, month, 1).getDay(),
- data = [],
- row = [];
- setToStartOfDay(now);
- if (opts.firstDay > 0) {
- before -= opts.firstDay;
- if (before < 0) {
- before += 7;
- }
- }
- var previousMonth = month === 0 ? 11 : month - 1,
- nextMonth = month === 11 ? 0 : month + 1,
- yearOfPreviousMonth = month === 0 ? year - 1 : year,
- yearOfNextMonth = month === 11 ? year + 1 : year,
- daysInPreviousMonth = getDaysInMonth(yearOfPreviousMonth, previousMonth);
- var cells = days + before,
- after = cells;
- while(after > 7) {
- after -= 7;
- }
- cells += 7 - after;
- for (var i = 0, r = 0; i < cells; i++)
- {
- var day = new Date(year, month, 1 + (i - before)),
- isSelected = isDate(this._d) ? compareDates(day, this._d) : false,
- isToday = compareDates(day, now),
- isEmpty = i < before || i >= (days + before),
- dayNumber = 1 + (i - before),
- monthNumber = month,
- yearNumber = year,
- isStartRange = opts.startRange && compareDates(opts.startRange, day),
- isEndRange = opts.endRange && compareDates(opts.endRange, day),
- isInRange = opts.startRange && opts.endRange && opts.startRange < day && day < opts.endRange,
- isDisabled = (opts.minDate && day < opts.minDate) ||
- (opts.maxDate && day > opts.maxDate) ||
- (opts.disableWeekends && isWeekend(day)) ||
- (opts.disableDayFn && opts.disableDayFn(day));
-
- if (isEmpty) {
- if (i < before) {
- dayNumber = daysInPreviousMonth + dayNumber;
- monthNumber = previousMonth;
- yearNumber = yearOfPreviousMonth;
- } else {
- dayNumber = dayNumber - days;
- monthNumber = nextMonth;
- yearNumber = yearOfNextMonth;
- }
- }
-
- var dayConfig = {
- day: dayNumber,
- month: monthNumber,
- year: yearNumber,
- isSelected: isSelected,
- isToday: isToday,
- isDisabled: isDisabled,
- isEmpty: isEmpty,
- isStartRange: isStartRange,
- isEndRange: isEndRange,
- isInRange: isInRange,
- showDaysInNextAndPreviousMonths: opts.showDaysInNextAndPreviousMonths
- };
-
- row.push(renderDay(dayConfig));
-
- if (++r === 7) {
- if (opts.showWeekNumber) {
- row.unshift(renderWeek(i - before, month, year));
- }
- data.push(renderRow(row, opts.isRTL));
- row = [];
- r = 0;
- }
- }
- return renderTable(opts, data, randId);
- },
-
- isVisible: function()
- {
- return this._v;
- },
-
- show: function()
- {
- if (!this.isVisible()) {
- removeClass(this.el, 'is-hidden');
- this._v = true;
- this.draw();
- if (this._o.bound) {
- addEvent(document, 'click', this._onClick);
- this.adjustPosition();
- }
- if (typeof this._o.onOpen === 'function') {
- this._o.onOpen.call(this);
- }
- }
- },
-
- hide: function()
- {
- var v = this._v;
- if (v !== false) {
- if (this._o.bound) {
- removeEvent(document, 'click', this._onClick);
- }
- this.el.style.position = 'static'; // reset
- this.el.style.left = 'auto';
- this.el.style.top = 'auto';
- addClass(this.el, 'is-hidden');
- this._v = false;
- if (v !== undefined && typeof this._o.onClose === 'function') {
- this._o.onClose.call(this);
- }
- }
- },
-
- /**
- * GAME OVER
- */
- destroy: function()
- {
- this.hide();
- removeEvent(this.el, 'mousedown', this._onMouseDown, true);
- removeEvent(this.el, 'touchend', this._onMouseDown, true);
- removeEvent(this.el, 'change', this._onChange);
- if (this._o.field) {
- removeEvent(this._o.field, 'change', this._onInputChange);
- if (this._o.bound) {
- removeEvent(this._o.trigger, 'click', this._onInputClick);
- removeEvent(this._o.trigger, 'focus', this._onInputFocus);
- removeEvent(this._o.trigger, 'blur', this._onInputBlur);
- }
- }
- if (this.el.parentNode) {
- this.el.parentNode.removeChild(this.el);
- }
- }
-
- };
-
- return Pikaday;
-
-}));
+!function(a,b){"use strict";var c;if("object"==typeof exports){try{c=require("moment")}catch(a){}module.exports=b(c)}else"function"==typeof define&&define.amd?define(function(a){var d="moment";try{c=a(d)}catch(a){}return b(c)}):a.Pikaday=b(a.moment)}(this,function(a){"use strict";var b="function"==typeof a,c=!!window.addEventListener,d=window.document,e=window.setTimeout,f=function(a,b,d,e){c?a.addEventListener(b,d,!!e):a.attachEvent("on"+b,d)},g=function(a,b,d,e){c?a.removeEventListener(b,d,!!e):a.detachEvent("on"+b,d)},h=function(a,b,c){var e;d.createEvent?(e=d.createEvent("HTMLEvents"),e.initEvent(b,!0,!1),e=t(e,c),a.dispatchEvent(e)):d.createEventObject&&(e=d.createEventObject(),e=t(e,c),a.fireEvent("on"+b,e))},i=function(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")},j=function(a,b){return(" "+a.className+" ").indexOf(" "+b+" ")!==-1},k=function(a,b){j(a,b)||(a.className=""===a.className?b:a.className+" "+b)},l=function(a,b){a.className=i((" "+a.className+" ").replace(" "+b+" "," "))},m=function(a){return/Array/.test(Object.prototype.toString.call(a))},n=function(a){return/Date/.test(Object.prototype.toString.call(a))&&!isNaN(a.getTime())},o=function(a){var b=a.getDay();return 0===b||6===b},p=function(a){return a%4===0&&a%100!==0||a%400===0},q=function(a,b){return[31,p(a)?29:28,31,30,31,30,31,31,30,31,30,31][b]},r=function(a){n(a)&&a.setHours(0,0,0,0)},s=function(a,b){var c=new Date(a.getTime()),d=new Date(b.getTime());return r(c),r(d),c.getTime()===d.getTime()},t=function(a,b,c){var d,e;for(d in b)e=void 0!==a[d],e&&"object"==typeof b[d]&&null!==b[d]&&void 0===b[d].nodeName?n(b[d])?c&&(a[d]=new Date(b[d].getTime())):m(b[d])?c&&(a[d]=b[d].slice(0)):a[d]=t({},b[d],c):!c&&e||(a[d]=b[d]);return a},u=function(a){return a.month<0&&(a.year-=Math.ceil(Math.abs(a.month)/12),a.month+=12),a.month>11&&(a.year+=Math.floor(Math.abs(a.month)/12),a.month-=12),a},v={field:null,bound:void 0,position:"bottom left",reposition:!0,format:null,inputFormats:null,defaultDate:null,setDefaultDate:!1,firstDay:0,formatStrict:!1,minDate:null,maxDate:null,yearRange:10,showWeekNumber:!1,minYear:0,maxYear:9999,minMonth:void 0,maxMonth:void 0,startRange:null,endRange:null,isRTL:!1,yearSuffix:"",showMonthAfterYear:!1,showDaysInNextAndPreviousMonths:!1,numberOfMonths:1,showTime:!0,showSeconds:!1,use24hour:!1,incrementHourBy:1,incrementMinuteBy:1,incrementSecondBy:1,timeLabel:null,autoClose:!0,mainCalendar:"left",container:void 0,i18n:{previousMonth:"Previous Month",nextMonth:"Next Month",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],midnight:"Midnight",noon:"Noon"},theme:null,onSelect:null,onOpen:null,onClose:null,onDraw:null},w=function(a,b,c){for(b+=a.firstDay;b>=7;)b-=7;return c?a.i18n.weekdaysShort[b]:a.i18n.weekdays[b]},x=function(a){var b=[],c="false";if(a.isEmpty){if(!a.showDaysInNextAndPreviousMonths)return' | ';b.push("is-outside-current-month")}return a.isDisabled&&b.push("is-disabled"),a.isToday&&b.push("is-today"),a.isSelected&&(b.push("is-selected"),c="true"),a.isInRange&&b.push("is-inrange"),a.isStartRange&&b.push("is-startrange"),a.isEndRange&&b.push("is-endrange"),' | "},y=function(a,b,c){var d=new Date(c,0,1),e=Math.ceil(((new Date(c,b,a)-d)/864e5+d.getDay()+1)/7);return''+e+" | "},z=function(a,b){return""+(b?a.reverse():a).join("")+"
"},A=function(a){return""+a.join("")+""},B=function(a){var b,c=[];for(a.showWeekNumber&&c.push(" | "),b=0;b<7;b++)c.push(''+w(a,b,!0)+" | ");return""+(a.isRTL?c.reverse():c).join("")+"
"},C=function(a,b,c,d,e,f){var g,h,i,o,p,j=a._o,k=c===j.minYear,l=c===j.maxYear,n='',q=!0,r=!0;for(i=[],g=0;g<12;g++)i.push('
");for(o='
'+j.i18n.months[d]+'
",m(j.yearRange)?(g=j.yearRange[0],h=j.yearRange[1]+1):(g=c-j.yearRange,h=1+c+j.yearRange),i=[];g
=j.minYear&&i.push('");return p=''+c+j.yearSuffix+'
",n+=j.showMonthAfterYear?p+o:o+p,k&&(0===d||j.minMonth>=d)&&(q=!1),l&&(11===d||j.maxMonth<=d)&&(r=!1),0===b&&(n+='"),b===a._o.numberOfMonths-1&&(n+='"),n+=" "},D=function(a,b,c){return'"},E=function(a,b,c,d,e){e=e||1;for(var f=' | "},F=function(a,b,c,d){var e=''+(null!==d.timeLabel?''+d.timeLabel+" | ":"")+E(24,a,"pika-select-hour",function(a){if(d.use24hour)return a;var b=a%12+(a<12?" AM":" PM");return"0 AM"==b?d.i18n.midnight:"0 PM"==b?d.i18n.noon:b},d.incrementHourBy)+": | "+E(60,b,"pika-select-minute",function(a){return a<10?"0"+a:a},d.incrementMinuteBy);return d.showSeconds&&(e+=": | "+E(60,c,"pika-select-second",function(a){return a<10?"0"+a:a},d.incrementSecondBy)),e+"
"},G=function(g){var h=this,i=h.config(g);h._onMouseDown=function(a){if(h._v){a=a||window.event;var b=a.target||a.srcElement;if(b){if(!j(b,"is-disabled"))if(!j(b,"pika-button")||j(b,"is-empty")||j(b.parentNode,"is-disabled"))j(b,"pika-prev")?h.prevMonth():j(b,"pika-next")&&h.nextMonth();else{var c=new Date(b.getAttribute("data-pika-year"),b.getAttribute("data-pika-month"),b.getAttribute("data-pika-day")),d=h._d||i.defaultDate;d&&n(d)&&i.showTime&&(c.setHours(d.getHours()),c.setMinutes(d.getMinutes()),i.showSeconds&&c.setSeconds(d.getSeconds())),h.setDate(c),i.bound&&e(function(){i.autoClose&&h.hide(),i.field&&i.field.blur()},100)}if(j(b,"pika-select"))h._c=!0;else{if(!a.preventDefault)return a.returnValue=!1,!1;a.preventDefault()}}}},h._onChange=function(a){a=a||window.event;var b=a.target||a.srcElement;b&&(j(b,"pika-select-month")?h.gotoMonth(b.value):j(b,"pika-select-year")?h.gotoYear(b.value):j(b,"pika-select-hour")?h.setTime(b.value):j(b,"pika-select-minute")?h.setTime(null,b.value):j(b,"pika-select-second")&&h.setTime(null,null,b.value))},h._onKeyChange=function(a){if(a=a||window.event,h.isVisible())switch(a.keyCode){case 13:case 27:i.field.blur();break;case 37:a.preventDefault(),h.adjustDate("subtract",1);break;case 38:h.adjustDate("subtract",7);break;case 39:h.adjustDate("add",1);break;case 40:h.adjustDate("add",7)}},h._onInputChange=function(c){var d;c.firedBy!==h&&(b?(d=a(i.field.value,i.inputFormats,i.formatStrict),d=d&&d.isValid()?d.toDate():null):d=new Date(Date.parse(i.field.value)),n(d)&&h.setDate(d),h._v||h.show())},h._onInputFocus=function(){h.show()},h._onInputClick=function(){h.show()},h._onInputBlur=function(){var a=d.activeElement;do if(j(a,"pika-single"))return;while(a=a.parentNode);i.autoClose&&!h._c&&(h._b=e(function(){h.hide()},50)),h._c=!1},h._onClick=function(a){a=a||window.event;var b=a.target||a.srcElement,d=b;if(b){!c&&j(b,"pika-select")&&(b.onchange||(b.setAttribute("onchange","return;"),f(b,"change",h._onChange)));do if(j(d,"pika-single")||d===i.trigger||i.showTime&&j(d,"pika-time-container"))return;while(d=d.parentNode);h._v&&b!==i.trigger&&d!==i.trigger&&h.hide()}},h.el=d.createElement("div"),h.el.className="pika-single"+(i.isRTL?" is-rtl":"")+(i.theme?" "+i.theme:""),f(h.el,"mousedown",h._onMouseDown,!0),f(h.el,"touchend",h._onMouseDown,!0),f(h.el,"change",h._onChange),f(d,"keydown",h._onKeyChange),i.field&&(i.container?i.container.appendChild(h.el):i.bound?d.body.appendChild(h.el):i.field.parentNode.insertBefore(h.el,i.field.nextSibling),f(i.field,"change",h._onInputChange),i.defaultDate||(b&&i.field.value?i.defaultDate=a(i.field.value,i.inputFormats).toDate():i.defaultDate=new Date(Date.parse(i.field.value)),i.setDefaultDate=!0));var k=i.defaultDate;n(k)?i.setDefaultDate?h.setDate(k,!0):h.gotoDate(k):h.gotoDate(new Date),i.bound?(this.hide(),h.el.className+=" is-bound",f(i.trigger,"click",h._onInputClick),f(i.trigger,"focus",h._onInputFocus),f(i.trigger,"blur",h._onInputBlur)):this.show()};return G.prototype={config:function(a){this._o||(this._o=t({},v,!0));var b=t(this._o,a,!0);b.isRTL=!!b.isRTL,b.autoClose=!!b.autoClose,b.field=b.field&&b.field.nodeName?b.field:null,b.theme="string"==typeof b.theme&&b.theme?b.theme:null,b.bound=!!(void 0!==b.bound?b.field&&b.bound:b.field),b.trigger=b.trigger&&b.trigger.nodeName?b.trigger:b.field,b.disableWeekends=!!b.disableWeekends,b.disableDayFn="function"==typeof b.disableDayFn?b.disableDayFn:null;var c=parseInt(b.numberOfMonths,10)||1;if(b.numberOfMonths=c>4?4:c,n(b.minDate)||(b.minDate=!1),n(b.maxDate)||(b.maxDate=!1),b.minDate&&b.maxDate&&b.maxDate100&&(b.yearRange=100);return null===b.format&&(b.format="YYYY-MM-DD",b.showTime&&(b.format+=" HH:mm:ss")),b.inputFormats||(b.inputFormats=b.format),b},toString:function(c){return n(this._d)?b?a(this._d).format(c||this._o.format):this._o.showTime?this._d.toString():this._d.toDateString():""},getMoment:function(){return b?a(this._d):null},setMoment:function(c,d){b&&a.isMoment(c)&&this.setDate(c.toDate(),d)},getDate:function(){return n(this._d)?new Date(this._d.getTime()):new Date},setTime:function(a,b,c){this._d||(this._d=new Date,this._d.setHours(0,0,0,0)),a&&this._d.setHours(a),b&&this._d.setMinutes(b),c&&this._d.setSeconds(c),this.setDate(this._d)},setDate:function(a,b){if(!a)return this._d=null,this._o.field&&(this._o.field.value="",h(this._o.field,"change",{firedBy:this})),this.draw();if("string"==typeof a&&(a=new Date(Date.parse(a))),n(a)){var c=this._o.minDate,d=this._o.maxDate;n(c)&&ad&&(a=d),this._d=new Date(a.getTime()),this._o.showTime&&!this._o.showSeconds?this._d.setSeconds(0):this._o.showTime||r(this._d),this.gotoDate(this._d),this._o.field&&(this._o.field.value=this.toString(),h(this._o.field,"change",{firedBy:this})),b||"function"!=typeof this._o.onSelect||this._o.onSelect.call(this,this.getDate())}},gotoDate:function(a){var b=!0;if(n(a)){if(this.calendars){var c=new Date(this.calendars[0].year,this.calendars[0].month,1),d=new Date(this.calendars[this.calendars.length-1].year,this.calendars[this.calendars.length-1].month,1),e=a.getTime();d.setMonth(d.getMonth()+1),d.setDate(d.getDate()-1),b=e=d&&(this._y=d,!isNaN(g)&&this._m>g&&(this._m=g)),i="pika-title-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,2);for(var j=0;j'+C(this,j,this.calendars[j].year,this.calendars[j].month,this.calendars[0].year,i)+this.render(this.calendars[j].year,this.calendars[j].month,i)+"";if(b.showTime){var k=this._d||this._o.defaultDate;h+=''+F(k&&n(k)?k.getHours():0,k&&n(k)?k.getMinutes():0,k&&n(k)?k.getSeconds():0,b)+"
"}this.el.innerHTML=h,b.bound&&"hidden"!==b.field.type&&e(function(){b.trigger.focus()},1),"function"==typeof this._o.onDraw&&this._o.onDraw(this),this._o.field.setAttribute("aria-label","Use the arrow keys to pick a date")}},adjustPosition:function(){var a,b,c,e,f,g,h,i,j,k;if(!this._o.container){if(this.el.style.position="absolute",a=this._o.trigger,b=a,c=this.el.offsetWidth,e=this.el.offsetHeight,f=window.innerWidth||d.documentElement.clientWidth,g=window.innerHeight||d.documentElement.clientHeight,h=window.pageYOffset||d.body.scrollTop||d.documentElement.scrollTop,"function"==typeof a.getBoundingClientRect)k=a.getBoundingClientRect(),i=k.left+window.pageXOffset,j=k.bottom+window.pageYOffset;else for(i=b.offsetLeft,j=b.offsetTop+b.offsetHeight;b=b.offsetParent;)i+=b.offsetLeft,j+=b.offsetTop;(this._o.reposition&&i+c>f||this._o.position.indexOf("right")>-1&&i-c+a.offsetWidth>0)&&(i=i-c+a.offsetWidth),(this._o.reposition&&j+e>g+h||this._o.position.indexOf("top")>-1&&j-e-a.offsetHeight>0)&&(j=j-e-a.offsetHeight),this.el.style.left=i+"px",this.el.style.top=j+"px"}},render:function(a,b,c){var d=this._o,e=new Date,f=q(a,b),g=new Date(a,b,1).getDay(),h=[],i=[];d.showTime||r(e),d.firstDay>0&&(g-=d.firstDay,g<0&&(g+=7));for(var j=0===b?11:b-1,k=11===b?0:b+1,l=0===b?a-1:a,m=11===b?a+1:a,p=q(l,j),t=f+g,u=t;u>7;)u-=7;t+=7-u;for(var v=d.minDate?new Date(d.minDate.getFullYear(),d.minDate.getMonth(),d.minDate.getDate()):null,w=d.maxDate?new Date(d.maxDate.getFullYear(),d.maxDate.getMonth(),d.maxDate.getDate()):null,A=0,B=0;A=f+g,H=1+(A-g),I=b,J=a,K=d.startRange&&s(d.startRange,C),L=d.endRange&&s(d.endRange,C),M=d.startRange&&d.endRange&&d.startRangew||d.disableWeekends&&o(C)||d.disableDayFn&&d.disableDayFn(C);G&&(A