flatpickr_rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -21
  3. data/lib/flatpickr_rails/version.rb +1 -1
  4. data/vendor/assets/javascripts/flatpickr.js +1506 -0
  5. data/vendor/assets/javascripts/flatpickr/l10n/ar.js +16 -0
  6. data/vendor/assets/javascripts/flatpickr/l10n/bg.js +16 -0
  7. data/vendor/assets/javascripts/flatpickr/l10n/bn.js +16 -0
  8. data/vendor/assets/javascripts/flatpickr/l10n/cat.js +36 -0
  9. data/vendor/assets/javascripts/flatpickr/l10n/cs.js +22 -0
  10. data/vendor/assets/javascripts/flatpickr/l10n/da.js +20 -0
  11. data/vendor/assets/javascripts/flatpickr/l10n/de.js +16 -0
  12. data/vendor/assets/javascripts/flatpickr/l10n/es.js +22 -0
  13. data/vendor/assets/javascripts/flatpickr/l10n/et.js +27 -0
  14. data/vendor/assets/javascripts/flatpickr/l10n/fa.js +20 -0
  15. data/vendor/assets/javascripts/flatpickr/l10n/fi.js +22 -0
  16. data/vendor/assets/javascripts/flatpickr/l10n/fr.js +26 -0
  17. data/vendor/assets/javascripts/flatpickr/l10n/he.js +16 -0
  18. data/vendor/assets/javascripts/flatpickr/l10n/hi.js +16 -0
  19. data/vendor/assets/javascripts/flatpickr/l10n/hr.js +19 -0
  20. data/vendor/assets/javascripts/flatpickr/l10n/hu.js +27 -0
  21. data/vendor/assets/javascripts/flatpickr/l10n/id.js +22 -0
  22. data/vendor/assets/javascripts/flatpickr/l10n/it.js +27 -0
  23. data/vendor/assets/javascripts/flatpickr/l10n/ja.js +16 -0
  24. data/vendor/assets/javascripts/flatpickr/l10n/ko.js +20 -0
  25. data/vendor/assets/javascripts/flatpickr/l10n/ms.js +22 -0
  26. data/vendor/assets/javascripts/flatpickr/l10n/my.js +22 -0
  27. data/vendor/assets/javascripts/flatpickr/l10n/nl.js +26 -0
  28. data/vendor/assets/javascripts/flatpickr/l10n/no.js +20 -0
  29. data/vendor/assets/javascripts/flatpickr/l10n/pa.js +16 -0
  30. data/vendor/assets/javascripts/flatpickr/l10n/pl.js +20 -0
  31. data/vendor/assets/javascripts/flatpickr/l10n/pt.js +16 -0
  32. data/vendor/assets/javascripts/flatpickr/l10n/ro.js +23 -0
  33. data/vendor/assets/javascripts/flatpickr/l10n/ru.js +16 -0
  34. data/vendor/assets/javascripts/flatpickr/l10n/si.js +17 -0
  35. data/vendor/assets/javascripts/flatpickr/l10n/sq.js +16 -0
  36. data/vendor/assets/javascripts/flatpickr/l10n/sv.js +22 -0
  37. data/vendor/assets/javascripts/flatpickr/l10n/tr.js +18 -0
  38. data/vendor/assets/javascripts/flatpickr/l10n/uk.js +16 -0
  39. data/vendor/assets/javascripts/flatpickr/l10n/vn.js +19 -0
  40. data/vendor/assets/javascripts/flatpickr/l10n/zh.js +17 -0
  41. data/vendor/assets/stylesheets/flatpickr.airbnb.css +1 -0
  42. data/vendor/assets/stylesheets/flatpickr.base16_flat.css +1 -0
  43. data/vendor/assets/stylesheets/flatpickr.confetti.css +1 -246
  44. data/vendor/assets/stylesheets/flatpickr.css +1 -242
  45. data/vendor/assets/stylesheets/flatpickr.dark.css +1 -243
  46. data/vendor/assets/stylesheets/flatpickr.material_blue.css +1 -246
  47. data/vendor/assets/stylesheets/flatpickr.material_green.css +1 -246
  48. data/vendor/assets/stylesheets/flatpickr.material_orange.css +1 -246
  49. data/vendor/assets/stylesheets/flatpickr.material_red.css +1 -246
  50. metadata +42 -6
  51. data/vendor/assets/javascripts/flatpickr/core.js +0 -1034
  52. data/vendor/assets/javascripts/flatpickr/index.js +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c9beb2da6da1caeb4515a09327b6524a41590822
4
- data.tar.gz: d02cdf657db34b7becbbb22c8c28690ab1932e83
3
+ metadata.gz: b8e2453da60064417141c7f5d3b61669c73d3027
4
+ data.tar.gz: 2eb0b4f5699ae4f0101532dca9b9e339969f9fbb
5
5
  SHA512:
6
- metadata.gz: 17837c29c8e131e94165ba9471dff4ca67f72745d9bb76fc366039981b9db8f3ea6f59cab3275b7292016a05f3af786f7fc1d2eb8ce973a1b8339e945cc45ba2
7
- data.tar.gz: aa5c6817e1a5c96b05e9f3f2aa71d1d756e4c8d23b41767ecbe91a1a6b97b1ef6db98af9e09d34a1a96a033760f5defe9fc73e824291541cbdf57c87d84c8695
6
+ metadata.gz: bb607125c876602b4546b54db379081fac4a45ece9a38a545df67bd77d8288e9efd2740bc251bca9e3e6b5fd9189fcfc746cab1c04dae99c276adc3542020ee5
7
+ data.tar.gz: a2b1250deb6cabd1154a34974e442be9bb1866ad3eaf14a5d735dfeea1bdaf4e385bfd43c219eccba02b1a4495317fa6a6678067a2306ec556261ddb1be9a338
data/README.md CHANGED
@@ -26,31 +26,30 @@ Or install it yourself as:
26
26
 
27
27
  Add this line to app/assets/stylesheets/application.css
28
28
 
29
- ``` css
30
- *= require "flatpickr"
31
- *= require "flatpickr.material_red" # Themes
32
- OR
33
- *= require "flatpickr.confetti.css"
34
- OR
35
- *= require "flatpickr.css"
36
- OR
37
- *= require "flatpickr.dark.css"
38
- OR
39
- *= require "flatpickr.material_blue.css"
40
- OR
41
- *= require "flatpickr.material_green.css"
42
- OR
43
- *= require "flatpickr.material_orange.css"
44
- OR
45
- *= require "flatpickr.material_red.css"
46
- ```
47
-
29
+ ```css
30
+ *= require flatpickr
31
+ ```
32
+
33
+ To use one of the themes, add:
34
+
35
+ ```css
36
+ *= require flatpickr.material_red
37
+ ```
38
+
39
+ Available themes are: airbnb, base16_flat, confetti, dark, material_blue, material_green, material_orange, material_red.
40
+
48
41
  Add this line to app/assets/javascripts/application.js
49
42
 
50
- ``` javascript
43
+ ```javascript
51
44
  //= require flatpickr
52
45
  ```
53
46
 
47
+ If you need locales, add them like this:
48
+
49
+ ```javascript
50
+ //= require flatpickr/l10n/es
51
+ ```
52
+
54
53
  ## Using flatpickr-rails
55
54
 
56
55
 
@@ -66,11 +65,17 @@ Add this line to app/assets/javascripts/application.js
66
65
  </script>
67
66
  ```
68
67
 
68
+ or with jQuery:
69
+
70
+ ```javascript
71
+ $('#flatpickr-input').flatpickr();
72
+ ```
73
+
69
74
  Examples:
70
75
 
71
76
  https://github.com/chmln/flatpickr
72
77
 
73
- There are a lot of options you can pass to datepicker(). They are documented at [https://chmln.github.io/flatpickr/](https://chmln.github.io/flatpickr/)
78
+ There are a lot of options you can pass to flatpickr(). They are documented at [https://chmln.github.io/flatpickr/](https://chmln.github.io/flatpickr/)
74
79
 
75
80
  ## Development
76
81
 
@@ -1,3 +1,3 @@
1
1
  module FlatpickrRails
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -0,0 +1,1506 @@
1
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
+
3
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
+
5
+ /*! flatpickr v2.1.1, @license MIT */
6
+ function Flatpickr(element, config) {
7
+ var self = this;
8
+
9
+ function init() {
10
+ if (element._flatpickr) destroy(element._flatpickr);
11
+
12
+ element._flatpickr = self;
13
+
14
+ self.element = element;
15
+ self.instanceConfig = config || {};
16
+
17
+ setupFormats();
18
+
19
+ parseConfig();
20
+ setupLocale();
21
+ setupInputs();
22
+ setupDates();
23
+
24
+ setupHelperFunctions();
25
+
26
+ self.isOpen = self.config.inline;
27
+ self.changeMonth = changeMonth;
28
+ self.clear = clear;
29
+ self.close = close;
30
+ self.destroy = destroy;
31
+ self.formatDate = formatDate;
32
+ self.jumpToDate = jumpToDate;
33
+ self.open = open;
34
+ self.parseDate = parseDate;
35
+ self.redraw = redraw;
36
+ self.set = set;
37
+ self.setDate = setDate;
38
+ self.toggle = toggle;
39
+
40
+ self.isMobile = !self.config.disableMobile && self.config.mode === "single" && !self.config.disable.length && !self.config.enable.length && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
41
+
42
+ if (!self.isMobile) build();
43
+
44
+ bind();
45
+
46
+ if (self.selectedDates.length) {
47
+ if (self.config.enableTime) setHoursFromDate();
48
+ updateValue();
49
+ }
50
+
51
+ triggerEvent("Ready");
52
+ }
53
+
54
+ function updateTime(e) {
55
+ if (self.config.noCalendar && !self.selectedDates.length)
56
+ // picking time only
57
+ self.selectedDates = [self.now];
58
+
59
+ timeWrapper(e);
60
+
61
+ if (!self.selectedDates.length) return;
62
+
63
+ setHoursFromInputs();
64
+ updateValue();
65
+ }
66
+
67
+ function setHoursFromInputs() {
68
+ if (!self.config.enableTime) return;
69
+
70
+ var hours = parseInt(self.hourElement.value, 10) || 0,
71
+ minutes = (60 + (parseInt(self.minuteElement.value, 10) || 0)) % 60,
72
+ seconds = self.config.enableSeconds ? (60 + parseInt(self.secondElement.value, 10) || 0) % 60 : 0;
73
+
74
+ if (self.amPM) hours = hours % 12 + 12 * (self.amPM.innerHTML === "PM");
75
+
76
+ setHours(hours, minutes, seconds);
77
+ }
78
+
79
+ function setHoursFromDate(dateObj) {
80
+ setHours((dateObj || latestSelectedDateObj()).getHours(), (dateObj || latestSelectedDateObj()).getMinutes(), (dateObj || latestSelectedDateObj()).getSeconds());
81
+ }
82
+
83
+ function setHours(hours, minutes, seconds) {
84
+ if (self.selectedDates.length) self.selectedDates[self.selectedDates.length - 1].setHours(hours % 24, minutes, seconds || 0, 0);
85
+
86
+ if (!self.config.enableTime) return;
87
+
88
+ self.hourElement.value = self.pad(!self.config.time_24hr ? (12 + hours) % 12 + 12 * (hours % 12 === 0) : hours);
89
+
90
+ self.minuteElement.value = self.pad(minutes);
91
+
92
+ if (!self.config.time_24hr && self.selectedDates.length) self.amPM.textContent = latestSelectedDateObj().getHours() >= 12 ? "PM" : "AM";
93
+
94
+ if (self.config.enableSeconds) self.secondElement.value = self.pad(seconds);
95
+ }
96
+
97
+ function bind() {
98
+ if (self.config.wrap) {
99
+ ["open", "close", "toggle", "clear"].forEach(function (el) {
100
+ try {
101
+ self.element.querySelector("[data-" + el + "]").addEventListener("click", self[el]);
102
+ } catch (e) {
103
+ //
104
+ }
105
+ });
106
+ }
107
+
108
+ if ("createEvent" in document) {
109
+ self.changeEvent = document.createEvent("HTMLEvents");
110
+ self.changeEvent.initEvent("change", false, true);
111
+ }
112
+
113
+ if (self.isMobile) return setupMobile();
114
+
115
+ self.debouncedResize = debounce(onResize, 100);
116
+ self.triggerChange = function () {
117
+ return triggerEvent("Change");
118
+ };
119
+ self.debouncedChange = debounce(self.triggerChange, 1000);
120
+
121
+ if (self.config.mode === "range") self.days.addEventListener("mouseover", onMouseOver);
122
+
123
+ document.addEventListener("keydown", onKeyDown);
124
+ window.addEventListener("resize", self.debouncedResize);
125
+
126
+ document.addEventListener("click", documentClick);
127
+ document.addEventListener("blur", documentClick);
128
+
129
+ if (self.config.clickOpens) (self.altInput || self.input).addEventListener("focus", open);
130
+
131
+ if (!self.config.noCalendar) {
132
+ self.prevMonthNav.addEventListener("click", function () {
133
+ return changeMonth(-1);
134
+ });
135
+ self.nextMonthNav.addEventListener("click", function () {
136
+ return changeMonth(1);
137
+ });
138
+
139
+ self.currentYearElement.addEventListener("wheel", function (e) {
140
+ return debounce(yearScroll(e), 50);
141
+ });
142
+ self.currentYearElement.addEventListener("focus", function () {
143
+ self.currentYearElement.select();
144
+ });
145
+
146
+ self.currentYearElement.addEventListener("input", function (event) {
147
+ if (event.target.value.length === 4) {
148
+ self.currentYearElement.blur();
149
+ handleYearChange(event.target.value);
150
+ event.target.value = self.currentYear;
151
+ }
152
+ });
153
+
154
+ self.days.addEventListener("click", selectDate);
155
+ }
156
+
157
+ if (self.config.enableTime) {
158
+ self.timeContainer.addEventListener("wheel", function (e) {
159
+ return debounce(updateTime(e), 5);
160
+ });
161
+ self.timeContainer.addEventListener("input", updateTime);
162
+
163
+ self.timeContainer.addEventListener("wheel", self.debouncedChange);
164
+ self.timeContainer.addEventListener("input", self.triggerChange);
165
+
166
+ self.hourElement.addEventListener("focus", function () {
167
+ self.hourElement.select();
168
+ });
169
+ self.minuteElement.addEventListener("focus", function () {
170
+ self.minuteElement.select();
171
+ });
172
+
173
+ if (self.secondElement) {
174
+ self.secondElement.addEventListener("focus", function () {
175
+ self.secondElement.select();
176
+ });
177
+ }
178
+
179
+ if (self.amPM) {
180
+ self.amPM.addEventListener("click", function (e) {
181
+ updateTime(e);
182
+ self.triggerChange(e);
183
+ });
184
+ }
185
+ }
186
+ }
187
+
188
+ function jumpToDate(jumpDate) {
189
+ jumpDate = jumpDate ? parseDate(jumpDate) : latestSelectedDateObj() || (self.config.minDate > self.now ? self.config.minDate : self.now);
190
+
191
+ try {
192
+ self.currentYear = jumpDate.getFullYear();
193
+ self.currentMonth = jumpDate.getMonth();
194
+ } catch (e) {
195
+ console.error(e.stack);
196
+ console.warn("Invalid date supplied: " + jumpDate);
197
+ }
198
+
199
+ self.redraw();
200
+ }
201
+
202
+ function build() {
203
+ var fragment = document.createDocumentFragment();
204
+ self.calendarContainer = createElement("div", "flatpickr-calendar");
205
+ self.numInputType = navigator.userAgent.indexOf("MSIE 9.0") > 0 ? "text" : "number";
206
+
207
+ if (!self.config.noCalendar) {
208
+ fragment.appendChild(buildMonthNav());
209
+ self.innerContainer = createElement("div", "flatpickr-innerContainer");
210
+
211
+ if (self.config.weekNumbers) self.innerContainer.appendChild(buildWeeks());
212
+
213
+ self.rContainer = createElement("div", "flatpickr-rContainer");
214
+ self.rContainer.appendChild(buildWeekdays());
215
+ self.rContainer.appendChild(buildDays());
216
+ self.innerContainer.appendChild(self.rContainer);
217
+ fragment.appendChild(self.innerContainer);
218
+ }
219
+
220
+ if (self.config.enableTime) fragment.appendChild(buildTime());
221
+
222
+ self.calendarContainer.appendChild(fragment);
223
+
224
+ if (self.config.inline || self.config.static) {
225
+ self.calendarContainer.classList.add(self.config.inline ? "inline" : "static");
226
+ positionCalendar();
227
+
228
+ if (self.config.appendTo && self.config.appendTo.nodeType) self.config.appendTo.appendChild(self.calendarContainer);else {
229
+ self.element.parentNode.insertBefore(self.calendarContainer, (self.altInput || self.input).nextSibling);
230
+ }
231
+ } else document.body.appendChild(self.calendarContainer);
232
+ }
233
+
234
+ function buildDays() {
235
+ if (!self.days) {
236
+ self.days = createElement("div", "flatpickr-days");
237
+ self.days.tabIndex = -1;
238
+ }
239
+
240
+ self.firstOfMonth = (new Date(self.currentYear, self.currentMonth, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7;
241
+
242
+ self.prevMonthDays = self.utils.getDaysinMonth((self.currentMonth - 1 + 12) % 12);
243
+
244
+ var daysInMonth = self.utils.getDaysinMonth(),
245
+ days = document.createDocumentFragment();
246
+
247
+ var dayNumber = self.prevMonthDays + 1 - self.firstOfMonth,
248
+ currentDate = void 0,
249
+ dateIsDisabled = void 0;
250
+
251
+ if (self.config.weekNumbers) self.weekNumbers.innerHTML = "";
252
+
253
+ if (self.config.mode === "range") {
254
+ var dateLimits = self.config.enable.length || self.config.disable.length || self.config.mixDate || self.config.maxDate;
255
+ self.minRangeDate = new Date(self.currentYear, self.currentMonth - 1, dayNumber);
256
+ self.maxRangeDate = new Date(self.currentYear, self.currentMonth + 1, (42 - self.firstOfMonth) % daysInMonth);
257
+ }
258
+
259
+ self.days.innerHTML = "";
260
+
261
+ // prepend days from the ending of previous month
262
+ for (var i = 0; dayNumber <= self.prevMonthDays; i++, dayNumber++) {
263
+ var curDate = new Date(self.currentYear, self.currentMonth - 1, dayNumber, 0, 0, 0, 0, 0),
264
+ dateIsEnabled = isEnabled(curDate),
265
+ dayElement = createElement("span", "flatpickr-day prevMonthDay" + (!dateIsEnabled ? " disabled" : "") + (isDateInRange(curDate) ? " inRange" : "") + (self.selectedDates.length === 1 && (curDate < self.minRangeDate || curDate > self.maxRangeDate) ? " notAllowed" : "") + (isDateSelected(curDate) !== false ? " selected" : ""), dayNumber);
266
+
267
+ dayElement.dateObj = curDate;
268
+
269
+ if (dateIsEnabled) dayElement.tabIndex = 0;else if (self.selectedDates[0] && curDate > self.minRangeDate && curDate < self.selectedDates[0]) self.minRangeDate = curDate;else if (self.selectedDates[0] && curDate < self.maxRangeDate && curDate > self.selectedDates[0]) self.maxRangeDate = curDate;
270
+
271
+ triggerEvent("DayCreate", dayElement);
272
+ days.appendChild(dayElement);
273
+ }
274
+
275
+ // Start at 1 since there is no 0th day
276
+ for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++) {
277
+ currentDate = new Date(self.currentYear, self.currentMonth, dayNumber, 0, 0, 0, 0, 0);
278
+
279
+ if (self.config.weekNumbers && dayNumber % 7 === 1) {
280
+ self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='disabled flatpickr-day'>" + self.config.getWeek(currentDate) + "</span>");
281
+ }
282
+
283
+ dateIsDisabled = !isEnabled(currentDate);
284
+
285
+ var _dayElement = createElement("span", dateIsDisabled ? "flatpickr-day disabled" : "flatpickr-day" + (isDateInRange(currentDate) ? " inRange" : "") + (self.selectedDates.length === 1 && (currentDate < self.minRangeDate || currentDate > self.maxRangeDate) ? " notAllowed" : ""), dayNumber);
286
+
287
+ _dayElement.dateObj = currentDate;
288
+
289
+ if (equalDates(currentDate, self.now)) _dayElement.classList.add("today");
290
+
291
+ if (!dateIsDisabled) {
292
+ _dayElement.tabIndex = 0;
293
+
294
+ if (isDateSelected(currentDate)) {
295
+ _dayElement.classList.add("selected");
296
+ self.selectedDateElem = _dayElement;
297
+
298
+ if (self.config.mode === "range") {
299
+ _dayElement.className += equalDates(currentDate, self.selectedDates[0]) ? " startRange" : self.selectedDates.length > 1 ? " endRange" : "";
300
+ }
301
+ }
302
+ } else if (self.selectedDates[0] && currentDate > self.minRangeDate && currentDate < self.selectedDates[0]) self.minRangeDate = currentDate;else if (self.selectedDates[0] && currentDate < self.maxRangeDate && currentDate > self.selectedDates[0]) self.maxRangeDate = currentDate;
303
+
304
+ triggerEvent("DayCreate", _dayElement);
305
+ days.appendChild(_dayElement);
306
+ }
307
+
308
+ // append days from the next month
309
+ for (var dayNum = daysInMonth + 1; dayNum <= 42 - self.firstOfMonth; dayNum++) {
310
+ var _curDate = new Date(self.currentYear, self.currentMonth + 1, dayNum % daysInMonth, 0, 0, 0, 0, 0),
311
+ _dateIsEnabled = isEnabled(_curDate),
312
+ _dayElement2 = createElement("span", "flatpickr-day nextMonthDay" + (!_dateIsEnabled ? " disabled" : "") + (isDateInRange(_curDate) ? " inRange" : "") + (self.selectedDates.length === 1 && (_curDate < self.minRangeDate || _curDate > self.maxRangeDate) ? " notAllowed" : "") + (isDateSelected(_curDate) !== false ? " selected" : ""), dayNum % daysInMonth);
313
+
314
+ _dayElement2.dateObj = _curDate;
315
+
316
+ if (self.config.weekNumbers && dayNum % 7 === 1) {
317
+ self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='disabled flatpickr-day'>" + self.config.getWeek(_curDate) + "</span>");
318
+ }
319
+
320
+ if (_dateIsEnabled) _dayElement2.tabIndex = 0;else if (self.selectedDates[0] && _curDate > self.minRangeDate && _curDate < self.selectedDates[0]) self.minRangeDate = _curDate;else if (self.selectedDates[0] && _curDate < self.maxRangeDate && _curDate > self.selectedDates[0]) self.maxRangeDate = _curDate;
321
+
322
+ triggerEvent("DayCreate", _dayElement2);
323
+ days.appendChild(_dayElement2);
324
+ }
325
+ self.days.appendChild(days);
326
+ return self.days;
327
+ }
328
+
329
+ function buildMonthNav() {
330
+ var monthNavFragment = document.createDocumentFragment();
331
+ self.monthNav = createElement("div", "flatpickr-month");
332
+
333
+ self.prevMonthNav = createElement("span", "flatpickr-prev-month");
334
+ self.prevMonthNav.innerHTML = self.config.prevArrow;
335
+
336
+ self.currentMonthElement = createElement("span", "cur-month");
337
+
338
+ self.currentYearElement = createElement("input", "cur-year");
339
+ self.currentYearElement.type = self.numInputType;
340
+ self.currentYearElement.title = self.l10n.scrollTitle;
341
+
342
+ if (self.config.minDate) self.currentYearElement.min = self.config.minDate.getFullYear();
343
+
344
+ if (self.config.maxDate) {
345
+ self.currentYearElement.max = self.config.maxDate.getFullYear();
346
+
347
+ self.currentYearElement.disabled = self.config.minDate && self.config.minDate.getFullYear() === self.config.maxDate.getFullYear();
348
+ }
349
+
350
+ self.nextMonthNav = createElement("span", "flatpickr-next-month");
351
+ self.nextMonthNav.innerHTML = self.config.nextArrow;
352
+
353
+ self.navigationCurrentMonth = createElement("span", "flatpickr-current-month");
354
+ self.navigationCurrentMonth.appendChild(self.currentMonthElement);
355
+ self.navigationCurrentMonth.appendChild(self.currentYearElement);
356
+
357
+ monthNavFragment.appendChild(self.prevMonthNav);
358
+ monthNavFragment.appendChild(self.navigationCurrentMonth);
359
+ monthNavFragment.appendChild(self.nextMonthNav);
360
+ self.monthNav.appendChild(monthNavFragment);
361
+
362
+ updateNavigationCurrentMonth();
363
+
364
+ return self.monthNav;
365
+ }
366
+
367
+ function buildTime() {
368
+ self.calendarContainer.classList.add("hasTime");
369
+ self.timeContainer = createElement("div", "flatpickr-time");
370
+ self.timeContainer.tabIndex = -1;
371
+ var separator = createElement("span", "flatpickr-time-separator", ":");
372
+
373
+ self.hourElement = createElement("input", "flatpickr-hour");
374
+ self.minuteElement = createElement("input", "flatpickr-minute");
375
+
376
+ self.hourElement.tabIndex = self.minuteElement.tabIndex = 0;
377
+ self.hourElement.type = self.minuteElement.type = self.numInputType;
378
+ self.hourElement.pattern = self.minuteElement.pattern = "\d*";
379
+
380
+ self.hourElement.value = self.pad(latestSelectedDateObj() ? latestSelectedDateObj().getHours() : self.config.defaultHour);
381
+
382
+ self.minuteElement.value = self.pad(latestSelectedDateObj() ? latestSelectedDateObj().getMinutes() : self.config.defaultMinute);
383
+
384
+ self.hourElement.step = self.config.hourIncrement;
385
+ self.minuteElement.step = self.config.minuteIncrement;
386
+
387
+ self.hourElement.min = -(self.config.time_24hr ? 1 : 0);
388
+ self.hourElement.max = self.config.time_24hr ? 24 : 13;
389
+
390
+ self.minuteElement.min = -self.minuteElement.step;
391
+ self.minuteElement.max = 60;
392
+
393
+ self.hourElement.title = self.minuteElement.title = self.l10n.scrollTitle;
394
+
395
+ self.timeContainer.appendChild(self.hourElement);
396
+ self.timeContainer.appendChild(separator);
397
+ self.timeContainer.appendChild(self.minuteElement);
398
+
399
+ if (self.config.enableSeconds) {
400
+ self.timeContainer.classList.add("has-seconds");
401
+
402
+ self.secondElement = createElement("input", "flatpickr-second");
403
+ self.secondElement.type = self.numInputType;
404
+ self.secondElement.pattern = self.hourElement.pattern;
405
+ self.secondElement.value = latestSelectedDateObj() ? self.pad(latestSelectedDateObj().getSeconds()) : "00";
406
+
407
+ self.secondElement.step = self.minuteElement.step;
408
+ self.secondElement.min = self.minuteElement.min;
409
+ self.secondElement.max = self.minuteElement.max;
410
+
411
+ self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":"));
412
+ self.timeContainer.appendChild(self.secondElement);
413
+ }
414
+
415
+ if (!self.config.time_24hr) {
416
+ // add self.amPM if appropriate
417
+ self.amPM = createElement("span", "flatpickr-am-pm", ["AM", "PM"][self.hourElement.value > 11 | 0]);
418
+ self.amPM.title = self.l10n.toggleTitle;
419
+ self.amPM.tabIndex = 0;
420
+ self.timeContainer.appendChild(self.amPM);
421
+ }
422
+
423
+ return self.timeContainer;
424
+ }
425
+
426
+ function buildWeekdays() {
427
+ if (!self.weekdayContainer) self.weekdayContainer = createElement("div", "flatpickr-weekdays");
428
+
429
+ var firstDayOfWeek = self.l10n.firstDayOfWeek;
430
+ var weekdays = self.l10n.weekdays.shorthand.slice();
431
+
432
+ if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) {
433
+ weekdays = [].concat(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek));
434
+ }
435
+
436
+ self.weekdayContainer.innerHTML = "\n\t\t<span class=flatpickr-weekday>\n\t\t\t" + weekdays.join("</span><span class=flatpickr-weekday>") + "\n\t\t</span>\n\t\t";
437
+
438
+ return self.weekdayContainer;
439
+ }
440
+
441
+ function buildWeeks() {
442
+ self.calendarContainer.classList.add("hasWeeks");
443
+ self.weekWrapper = createElement("div", "flatpickr-weekwrapper");
444
+ self.weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation));
445
+ self.weekNumbers = createElement("div", "flatpickr-weeks");
446
+ self.weekWrapper.appendChild(self.weekNumbers);
447
+ return self.weekWrapper;
448
+ }
449
+
450
+ function changeMonth(value, is_offset) {
451
+ self.currentMonth = typeof is_offset === "undefined" || is_offset ? self.currentMonth + value : value;
452
+
453
+ handleYearChange();
454
+ updateNavigationCurrentMonth();
455
+ buildDays();
456
+
457
+ if (!self.config.noCalendar) self.days.focus();
458
+
459
+ triggerEvent("MonthChange");
460
+ }
461
+
462
+ function clear() {
463
+ self.input.value = "";
464
+
465
+ if (self.altInput) self.altInput.value = "";
466
+
467
+ if (self.mobileInput) self.mobileInput.value = "";
468
+
469
+ self.selectedDates = [];
470
+
471
+ triggerEvent("Change");
472
+ }
473
+
474
+ function close() {
475
+ self.isOpen = false;
476
+ self.calendarContainer.classList.remove("open");
477
+ (self.altInput || self.input).classList.remove("active");
478
+
479
+ triggerEvent("Close");
480
+ }
481
+
482
+ function destroy(instance) {
483
+ instance = instance || self;
484
+ instance.clear();
485
+
486
+ document.removeEventListener("keydown", onKeyDown);
487
+ window.removeEventListener("resize", instance.debouncedResize);
488
+
489
+ document.removeEventListener("click", documentClick);
490
+ document.removeEventListener("blur", documentClick);
491
+
492
+ if (instance.isMobile && instance.mobileInput && instance.mobileInput.parentNode) instance.mobileInput.parentNode.removeChild(instance.mobileInput);else if (instance.calendarContainer && instance.calendarContainer.parentNode) instance.calendarContainer.parentNode.removeChild(instance.calendarContainer);
493
+
494
+ if (instance.altInput) {
495
+ instance.input.type = "text";
496
+ if (instance.altInput.parentNode) instance.altInput.parentNode.removeChild(instance.altInput);
497
+ }
498
+
499
+ instance.input.classList.remove("flatpickr-input");
500
+ instance.input.removeEventListener("focus", open);
501
+ instance.input.removeAttribute("readonly");
502
+ }
503
+
504
+ function isCalendarElem(elem) {
505
+ var e = elem;
506
+ while (e) {
507
+ if (/flatpickr-day|flatpickr-calendar/.test(e.className)) return true;
508
+ e = e.parentNode;
509
+ }
510
+
511
+ return false;
512
+ }
513
+
514
+ function documentClick(e) {
515
+ var isInput = self.element.contains(e.target) || e.target === self.input || e.target === self.altInput;
516
+
517
+ if (self.isOpen && !isCalendarElem(e.target) && !isInput) {
518
+ self.close();
519
+
520
+ if (self.config.mode === "range" && self.selectedDates.length === 1) {
521
+ self.clear();
522
+ self.redraw();
523
+ }
524
+ }
525
+ }
526
+
527
+ function formatDate(frmt, dateObj) {
528
+ var chars = frmt.split("");
529
+ return chars.map(function (c, i) {
530
+ return self.formats[c] && chars[i - 1] !== "\\" ? self.formats[c](dateObj) : c !== "\\" ? c : "";
531
+ }).join("");
532
+ }
533
+
534
+ function handleYearChange(newYear) {
535
+ if (self.currentMonth < 0 || self.currentMonth > 11) {
536
+ self.currentYear += self.currentMonth % 11;
537
+ self.currentMonth = (self.currentMonth + 12) % 12;
538
+ triggerEvent("YearChange");
539
+ } else if (newYear && (!self.currentYearElement.min || newYear >= self.currentYearElement.min) && (!self.currentYearElement.max || newYear <= self.currentYearElement.max)) {
540
+ self.currentYear = parseInt(newYear, 10) || self.currentYear;
541
+
542
+ if (self.config.maxDate && self.currentYear === self.config.maxDate.getFullYear()) self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth);else if (self.config.minDate && self.currentYear === self.config.minDate.getFullYear()) self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth);
543
+
544
+ self.redraw();
545
+ triggerEvent("YearChange");
546
+ }
547
+ }
548
+
549
+ function isEnabled(dateToCheck) {
550
+ if (self.config.minDate && dateToCheck < self.config.minDate || self.config.maxDate && dateToCheck > self.config.maxDate) return false;
551
+
552
+ if (!self.config.enable.length && !self.config.disable.length) return true;
553
+
554
+ dateToCheck = parseDate(dateToCheck, true); // timeless
555
+
556
+ var bool = self.config.enable.length > 0,
557
+ array = bool ? self.config.enable : self.config.disable;
558
+
559
+ for (var i = 0, d; i < array.length; i++) {
560
+ d = array[i];
561
+
562
+ if (d instanceof Function && d(dateToCheck)) // disabled by function
563
+ return bool;else if ((d instanceof Date || typeof d === "string") && parseDate(d, true).getTime() === dateToCheck.getTime())
564
+ // disabled by date string
565
+ return bool;else if ( // disabled by range
566
+ (typeof d === "undefined" ? "undefined" : _typeof(d)) === "object" && d.from && d.to && dateToCheck >= parseDate(d.from) && dateToCheck <= parseDate(d.to)) return bool;
567
+ }
568
+
569
+ return !bool;
570
+ }
571
+
572
+ function onKeyDown(e) {
573
+ if (self.isOpen) {
574
+ switch (e.which) {
575
+ case 13:
576
+ if (self.timeContainer && self.timeContainer.contains(e.target)) updateValue();else selectDate(e);
577
+
578
+ break;
579
+
580
+ case 27:
581
+ // escape
582
+ self.clear();
583
+ self.redraw();
584
+ self.close();
585
+ break;
586
+
587
+ case 37:
588
+ if (e.target !== self.input & e.target !== self.altInput) changeMonth(-1);
589
+ break;
590
+
591
+ case 38:
592
+ e.preventDefault();
593
+
594
+ if (self.timeContainer && self.timeContainer.contains(e.target)) updateTime(e);else {
595
+ self.currentYear++;
596
+ self.redraw();
597
+ }
598
+
599
+ break;
600
+
601
+ case 39:
602
+ if (e.target !== self.input & e.target !== self.altInput) changeMonth(1);
603
+ break;
604
+
605
+ case 40:
606
+ e.preventDefault();
607
+ if (self.timeContainer && self.timeContainer.contains(e.target)) updateTime(e);else {
608
+ self.currentYear--;
609
+ self.redraw();
610
+ }
611
+
612
+ break;
613
+
614
+ default:
615
+ break;
616
+ }
617
+ }
618
+ }
619
+
620
+ function onMouseOver(e) {
621
+ if (self.selectedDates.length !== 1 || !e.target.classList.contains("flatpickr-day")) return;
622
+
623
+ var hoverDate = e.target.dateObj,
624
+ rangeStartDate = Math.min(hoverDate.getTime(), self.selectedDates[0].getTime()),
625
+ rangeEndDate = Math.max(hoverDate.getTime(), self.selectedDates[0].getTime()),
626
+ containsDisabled = false;
627
+
628
+ for (var t = rangeStartDate; t < rangeEndDate; t += self.utils.duration.DAY) {
629
+ if (!isEnabled(new Date(t))) {
630
+ containsDisabled = true;
631
+ break;
632
+ }
633
+ }
634
+
635
+ for (var timestamp = self.days.childNodes[0].dateObj.getTime(), i = 0; i < 42; i++, timestamp += self.utils.duration.DAY) {
636
+ if (timestamp < self.minRangeDate.getTime() || timestamp > self.maxRangeDate.getTime()) {
637
+ self.days.childNodes[i].classList.add("notAllowed");
638
+ self.days.childNodes[i].classList.remove("inRange");
639
+ } else if (!containsDisabled && timestamp > Math.max(self.minRangeDate.getTime(), rangeStartDate) && timestamp < Math.min(self.maxRangeDate.getTime(), rangeEndDate)) self.days.childNodes[i].classList.add("inRange");else self.days.childNodes[i].classList.remove("inRange");
640
+ }
641
+ }
642
+
643
+ function onResize() {
644
+ if (self.isOpen && !self.config.inline && !self.config.static) positionCalendar();
645
+ }
646
+
647
+ function open(e) {
648
+ if (self.isMobile) {
649
+ e.preventDefault();
650
+ e.target.blur();
651
+
652
+ setTimeout(function () {
653
+ self.mobileInput.click();
654
+ }, 0);
655
+
656
+ triggerEvent("Open");
657
+ return;
658
+ } else if (self.isOpen || (self.altInput || self.input).disabled || self.config.inline) return;
659
+
660
+ self.calendarContainer.classList.add("open");
661
+
662
+ if (!self.config.static) positionCalendar();
663
+
664
+ self.isOpen = true;
665
+
666
+ if (!self.config.allowInput) {
667
+ (self.altInput || self.input).blur();
668
+ (self.config.noCalendar ? self.timeContainer : self.selectedDateElem ? self.selectedDateElem : self.days).focus();
669
+ }
670
+
671
+ (self.altInput || self.input).classList.add("active");
672
+ triggerEvent("Open");
673
+ }
674
+
675
+ function parseConfig() {
676
+ var boolOpts = ["utc", "wrap", "weekNumbers", "allowInput", "clickOpens", "time_24hr", "enableTime", "noCalendar", "altInput", "shorthandCurrentMonth", "inline", "static", "enableSeconds", "disableMobile"];
677
+ self.config = Object.create(Flatpickr.defaultConfig);
678
+ var userConfig = _extends({}, self.instanceConfig, self.element.dataset || {});
679
+
680
+ Object.defineProperty(self.config, "minDate", {
681
+ get: function get() {
682
+ return this._minDate;
683
+ },
684
+ set: function set(date) {
685
+ this._minDate = parseDate(date, true);
686
+ if (self.days) redraw();
687
+
688
+ if (!self.currentYearElement) return;
689
+
690
+ if (date && this._minDate instanceof Date) self.currentYearElement.min = this._minDate.getFullYear();else {
691
+ self.currentYearElement.removeAttribute("min");
692
+ }
693
+
694
+ self.currentYearElement.disabled = this._maxDate && this._minDate && this._maxDate.getFullYear() === this._minDate.getFullYear();
695
+ }
696
+ });
697
+
698
+ Object.defineProperty(self.config, "maxDate", {
699
+ get: function get() {
700
+ return this._maxDate;
701
+ },
702
+ set: function set(date) {
703
+ this._maxDate = parseDate(date);
704
+ this._maxDate instanceof Date && this._maxDate.setHours(23, 59, 59, 999);
705
+ if (self.days) redraw();
706
+
707
+ if (!self.currentYearElement) return;
708
+
709
+ if (date && this._maxDate instanceof Date) self.currentYearElement.max = this._maxDate.getFullYear();else self.currentYearElement.removeAttribute("max");
710
+
711
+ self.currentYearElement.disabled = this._maxDate && this._minDate && this._maxDate.getFullYear() === this._minDate.getFullYear();
712
+ }
713
+ });
714
+
715
+ _extends(self.config, userConfig);
716
+
717
+ for (var i = 0; i < boolOpts.length; i++) {
718
+ self.config[boolOpts[i]] = self.config[boolOpts[i]] === true || self.config[boolOpts[i]] === "true";
719
+ }if (!userConfig.dateFormat && userConfig.enableTime) {
720
+ self.config.dateFormat = self.config.noCalendar ? "H:i" + (self.config.enableSeconds ? ":S" : "") : Flatpickr.defaultConfig.dateFormat + " H:i" + (self.config.enableSeconds ? ":S" : "");
721
+ }
722
+
723
+ if (userConfig.altInput && userConfig.enableTime && !userConfig.altFormat) {
724
+ self.config.altFormat = self.config.noCalendar ? "h:i" + (self.config.enableSeconds ? ":S K" : " K") : Flatpickr.defaultConfig.altFormat + (" h:i" + (self.config.enableSeconds ? ":S" : "") + " K");
725
+ }
726
+ }
727
+
728
+ function setupLocale() {
729
+ if (_typeof(self.config.locale) !== "object" && typeof Flatpickr.l10ns[self.config.locale] === "undefined") console.warn("flatpickr: invalid locale " + self.config.locale);
730
+
731
+ self.l10n = _extends(Object.create(Flatpickr.l10ns.default), _typeof(self.config.locale) === "object" ? self.config.locale : self.config.locale !== "default" ? Flatpickr.l10ns[self.config.locale] || {} : {});
732
+ }
733
+
734
+ function parseDate(date) {
735
+ var timeless = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
736
+
737
+ if (!date) return null;
738
+
739
+ var dateTimeRegex = /(\d+)/g,
740
+ timeRegex = /^(\d{1,2})[:\s](\d\d)?[:\s]?(\d\d)?\s?(a|p)?/i,
741
+ timestamp = /^(\d+)$/g,
742
+ date_orig = date;
743
+
744
+ if (date.toFixed) // timestamp
745
+ date = new Date(date);else if (typeof date === "string") {
746
+ date = date.trim();
747
+
748
+ if (date === "today") {
749
+ date = new Date();
750
+ timeless = true;
751
+ } else if (self.config.parseDate) date = self.config.parseDate(date);else if (timeRegex.test(date)) {
752
+ // time picker
753
+ var m = date.match(timeRegex),
754
+ hours = !m[4] ? m[1] // military time, no conversion needed
755
+ : m[1] % 12 + (m[4].toLowerCase() === "p" ? 12 : 0); // am/pm
756
+
757
+ date = new Date();
758
+ date.setHours(hours, m[2] || 0, m[3] || 0);
759
+ } else if (/Z$/.test(date) || /GMT$/.test(date)) // datestrings w/ timezone
760
+ date = new Date(date);else if (dateTimeRegex.test(date) && /^[0-9]/.test(date)) {
761
+ var d = date.match(dateTimeRegex);
762
+ date = new Date(d[0] + "/" + (d[1] || 1) + "/" + (d[2] || 1) + " " + (d[3] || 0) + ":" + (d[4] || 0) + ":" + (d[5] || 0));
763
+ } else // fallback
764
+ date = new Date(date);
765
+ }
766
+
767
+ if (!(date instanceof Date)) {
768
+ console.warn("flatpickr: invalid date " + date_orig);
769
+ console.info(self.element);
770
+ return null;
771
+ }
772
+
773
+ if (self.config.utc && !date.fp_isUTC) date = date.fp_toUTC();
774
+
775
+ if (timeless) date.setHours(0, 0, 0, 0);
776
+
777
+ return date;
778
+ }
779
+
780
+ function positionCalendar() {
781
+ var calendarHeight = self.calendarContainer.offsetHeight,
782
+ input = self.altInput || self.input,
783
+ inputBounds = input.getBoundingClientRect(),
784
+ distanceFromBottom = window.innerHeight - inputBounds.bottom + input.offsetHeight;
785
+
786
+ var top = void 0,
787
+ left = window.pageXOffset + inputBounds.left;
788
+
789
+ if (distanceFromBottom < calendarHeight) {
790
+ top = window.pageYOffset - calendarHeight + inputBounds.top - 2;
791
+ self.calendarContainer.classList.remove("arrowTop");
792
+ self.calendarContainer.classList.add("arrowBottom");
793
+ } else {
794
+ top = window.pageYOffset + input.offsetHeight + inputBounds.top + 2;
795
+ self.calendarContainer.classList.remove("arrowBottom");
796
+ self.calendarContainer.classList.add("arrowTop");
797
+ }
798
+
799
+ if (!self.config.inline && !self.config.static) {
800
+ self.calendarContainer.style.top = top + "px";
801
+ self.calendarContainer.style.left = left + "px";
802
+ }
803
+ }
804
+
805
+ function redraw() {
806
+ if (self.config.noCalendar || self.isMobile) return;
807
+
808
+ buildWeekdays();
809
+ updateNavigationCurrentMonth();
810
+ buildDays();
811
+ }
812
+
813
+ function selectDate(e) {
814
+ if (self.config.allowInput && e.which === 13 && e.target === (self.altInput || self.input)) return self.setDate((self.altInput || self.input).value), e.target.blur();
815
+
816
+ if (!e.target.classList.contains("flatpickr-day") || e.target.classList.contains("disabled") || e.target.classList.contains("notAllowed")) return;
817
+
818
+ var selectedDate = e.target.dateObj;
819
+ self.selectedDateElem = e.target;
820
+
821
+ if (self.config.mode === "single") {
822
+ self.selectedDates = [selectedDate];
823
+
824
+ if (!self.config.enableTime) self.close();
825
+ } else if (self.config.mode === "multiple") {
826
+ var selectedIndex = isDateSelected(selectedDate);
827
+ if (selectedIndex) self.selectedDates.splice(selectedIndex, 1);else self.selectedDates.push(selectedDate);
828
+ } else if (self.config.mode === "range") {
829
+ if (self.selectedDates.length === 2) self.clear();
830
+
831
+ self.selectedDates.push(selectedDate);
832
+ self.selectedDates.sort(function (a, b) {
833
+ return a.getTime() - b.getTime();
834
+ });
835
+ }
836
+
837
+ setHoursFromInputs();
838
+
839
+ if (selectedDate.getMonth() !== self.currentMonth && self.config.mode !== "range") {
840
+ self.currentYear = selectedDate.getFullYear();
841
+ self.currentMonth = selectedDate.getMonth();
842
+ updateNavigationCurrentMonth();
843
+ }
844
+
845
+ updateValue();
846
+ buildDays();
847
+ triggerEvent("Change");
848
+
849
+ if (self.config.mode === "range" && self.selectedDates.length === 1) onMouseOver(e);
850
+ }
851
+
852
+ function set(option, value) {
853
+ self.config[option] = value;
854
+ self.redraw();
855
+ jumpToDate();
856
+ }
857
+
858
+ function setDate(date, triggerChange) {
859
+ if (!date) return self.clear();
860
+
861
+ self.selectedDates = (Array.isArray(date) ? date.map(parseDate) : [parseDate(date)]).filter(function (d) {
862
+ return d instanceof Date;
863
+ });
864
+ self.redraw();
865
+ jumpToDate();
866
+
867
+ setHoursFromDate();
868
+ updateValue();
869
+
870
+ if (triggerChange) triggerEvent("Change");
871
+ }
872
+
873
+ function setupDates() {
874
+ self.selectedDates = [];
875
+ self.now = new Date();
876
+ var inputDate = self.config.defaultDate || self.input.value;
877
+
878
+ if (Array.isArray(inputDate)) self.selectedDates = inputDate.map(parseDate);else if (inputDate) {
879
+ switch (self.config.mode) {
880
+ case "single":
881
+ self.selectedDates = [parseDate(inputDate)];
882
+ break;
883
+
884
+ case "multiple":
885
+ self.selectedDates = inputDate.split("; ").map(parseDate);
886
+ break;
887
+
888
+ case "range":
889
+ self.selectedDates = inputDate.split(" to ").map(parseDate);
890
+ break;
891
+
892
+ default:
893
+ break;
894
+ }
895
+ }
896
+
897
+ self.selectedDates = self.selectedDates.filter(function (d) {
898
+ return d instanceof Date && d.getTime() && isEnabled(d);
899
+ });
900
+
901
+ var initialDate = self.selectedDates.length ? self.selectedDates[0] : self.config.minDate > self.now ? self.config.minDate : self.now;
902
+
903
+ self.currentYear = initialDate.getFullYear();
904
+ self.currentMonth = initialDate.getMonth();
905
+ }
906
+
907
+ function setupHelperFunctions() {
908
+ self.utils = {
909
+ duration: {
910
+ DAY: 86400000
911
+ },
912
+ getDaysinMonth: function getDaysinMonth() {
913
+ var month = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : self.currentMonth;
914
+ var yr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : self.currentYear;
915
+
916
+ if (month === 1 && yr % 4 === 0 && yr % 100 !== 0 || yr % 400 === 0) return 29;
917
+ return self.l10n.daysInMonth[month];
918
+ },
919
+
920
+ monthToStr: function monthToStr(monthNumber) {
921
+ var short = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : self.config.shorthandCurrentMonth;
922
+ return self.l10n.months[(short ? "short" : "long") + "hand"][monthNumber];
923
+ }
924
+ };
925
+ }
926
+
927
+ function setupFormats() {
928
+ self.formats = {
929
+ // weekday name, short, e.g. Thu
930
+ D: function D(date) {
931
+ return self.l10n.weekdays.shorthand[self.formats.w(date)];
932
+ },
933
+
934
+ // full month name e.g. January
935
+ F: function F(date) {
936
+ return self.utils.monthToStr(self.formats.n(date) - 1, false);
937
+ },
938
+
939
+ // hours with leading zero e.g. 03
940
+ H: function H(date) {
941
+ return Flatpickr.prototype.pad(date.getHours());
942
+ },
943
+
944
+ // day (1-30) with ordinal suffix e.g. 1st, 2nd
945
+ J: function J(date) {
946
+ return date.getDate() + self.l10n.ordinal(date.getDate());
947
+ },
948
+
949
+ // AM/PM
950
+ K: function K(date) {
951
+ return date.getHours() > 11 ? "PM" : "AM";
952
+ },
953
+
954
+ // shorthand month e.g. Jan, Sep, Oct, etc
955
+ M: function M(date) {
956
+ return self.utils.monthToStr(date.getMonth(), true);
957
+ },
958
+
959
+ // seconds 00-59
960
+ S: function S(date) {
961
+ return Flatpickr.prototype.pad(date.getSeconds());
962
+ },
963
+
964
+ // unix timestamp
965
+ U: function U(date) {
966
+ return date.getTime() / 1000;
967
+ },
968
+
969
+ // full year e.g. 2016
970
+ Y: function Y(date) {
971
+ return date.getFullYear();
972
+ },
973
+
974
+ // day in month, padded (01-30)
975
+ d: function d(date) {
976
+ return Flatpickr.prototype.pad(self.formats.j(date));
977
+ },
978
+
979
+ // hour from 1-12 (am/pm)
980
+ h: function h(date) {
981
+ return date.getHours() % 12 ? date.getHours() % 12 : 12;
982
+ },
983
+
984
+ // minutes, padded with leading zero e.g. 09
985
+ i: function i(date) {
986
+ return Flatpickr.prototype.pad(date.getMinutes());
987
+ },
988
+
989
+ // day in month (1-30)
990
+ j: function j(date) {
991
+ return date.getDate();
992
+ },
993
+
994
+ // weekday name, full, e.g. Thursday
995
+ l: function l(date) {
996
+ return self.l10n.weekdays.longhand[self.formats.w(date)];
997
+ },
998
+
999
+ // padded month number (01-12)
1000
+ m: function m(date) {
1001
+ return Flatpickr.prototype.pad(self.formats.n(date));
1002
+ },
1003
+
1004
+ // the month number (1-12)
1005
+ n: function n(date) {
1006
+ return date.getMonth() + 1;
1007
+ },
1008
+
1009
+ // seconds 0-59
1010
+ s: function s(date) {
1011
+ return date.getSeconds();
1012
+ },
1013
+
1014
+ // number of the day of the week
1015
+ w: function w(date) {
1016
+ return date.getDay();
1017
+ },
1018
+
1019
+ // last two digits of year e.g. 16 for 2016
1020
+ y: function y(date) {
1021
+ return String(self.formats.Y(date)).substring(2);
1022
+ }
1023
+ };
1024
+ }
1025
+
1026
+ function setupInputs() {
1027
+ self.input = self.config.wrap ? self.element.querySelector("[data-input]") : self.element;
1028
+
1029
+ self.input.classList.add("flatpickr-input");
1030
+ if (self.config.altInput) {
1031
+ // replicate self.element
1032
+ self.altInput = createElement(self.input.nodeName, self.config.altInputClass);
1033
+ self.altInput.placeholder = self.input.placeholder;
1034
+ self.altInput.type = "text";
1035
+
1036
+ self.input.type = "hidden";
1037
+ if (self.input.parentNode) self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling);
1038
+ }
1039
+
1040
+ if (!self.config.allowInput) (self.altInput || self.input).setAttribute("readonly", "readonly");
1041
+ }
1042
+
1043
+ function setupMobile() {
1044
+ var inputType = self.config.enableTime ? self.config.noCalendar ? "time" : "datetime-local" : "date";
1045
+
1046
+ self.mobileInput = createElement("input", "flatpickr-input flatpickr-mobile");
1047
+ self.mobileInput.step = "any";
1048
+ self.mobileInput.tabIndex = -1;
1049
+ self.mobileInput.type = inputType;
1050
+ self.mobileInput.disabled = self.input.disabled;
1051
+
1052
+ self.mobileFormatStr = inputType === "datetime-local" ? "Y-m-d\\TH:i:S" : inputType === "date" ? "Y-m-d" : "H:i:S";
1053
+
1054
+ if (self.selectedDates.length) {
1055
+ self.mobileInput.defaultValue = self.mobileInput.value = formatDate(self.mobileFormatStr, self.selectedDates[0]);
1056
+ }
1057
+
1058
+ if (self.config.minDate) self.mobileInput.min = formatDate("Y-m-d", self.config.minDate);
1059
+
1060
+ if (self.config.maxDate) self.mobileInput.max = formatDate("Y-m-d", self.config.maxDate);
1061
+
1062
+ self.input.type = "hidden";
1063
+ if (self.config.altInput) self.altInput.type = "hidden";
1064
+
1065
+ try {
1066
+ self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling);
1067
+ } catch (e) {
1068
+ //
1069
+ }
1070
+
1071
+ self.mobileInput.addEventListener("change", function (e) {
1072
+ self.setDate(e.target.value);
1073
+ triggerEvent("Change");
1074
+ triggerEvent("Close");
1075
+ });
1076
+ }
1077
+
1078
+ function toggle() {
1079
+ if (self.isOpen) self.close();else self.open();
1080
+ }
1081
+
1082
+ function triggerEvent(event, data) {
1083
+ if (self.config["on" + event]) {
1084
+ var hooks = Array.isArray(self.config["on" + event]) ? self.config["on" + event] : [self.config["on" + event]];
1085
+
1086
+ for (var i = 0; i < hooks.length; i++) {
1087
+ hooks[i](self.selectedDates, self.input.value, self, data);
1088
+ }
1089
+ }
1090
+
1091
+ if (event === "Change") {
1092
+ try {
1093
+ self.input.dispatchEvent(new Event("change", { "bubbles": true }));
1094
+
1095
+ // many front-end frameworks bind to the input event
1096
+ self.input.dispatchEvent(new Event("input", { "bubbles": true }));
1097
+ } catch (e) {
1098
+ if ("createEvent" in document) return self.input.dispatchEvent(self.changeEvent);
1099
+
1100
+ self.input.fireEvent("onchange");
1101
+ }
1102
+ }
1103
+ }
1104
+
1105
+ function latestSelectedDateObj() {
1106
+ if (self.selectedDates.length) return self.selectedDates[self.selectedDates.length - 1];
1107
+ return null;
1108
+ }
1109
+
1110
+ function isDateSelected(date) {
1111
+ for (var i = 0; i < self.selectedDates.length; i++) {
1112
+ if (equalDates(self.selectedDates[i], date)) return "" + i;
1113
+ }
1114
+
1115
+ return false;
1116
+ }
1117
+
1118
+ function isDateInRange(date) {
1119
+ if (self.config.mode !== "range" || self.selectedDates.length < 2) return false;
1120
+ return date > self.selectedDates[0] && date < self.selectedDates[1];
1121
+ }
1122
+
1123
+ function updateNavigationCurrentMonth() {
1124
+ if (self.config.noCalendar || self.isMobile || !self.monthNav) return;
1125
+
1126
+ self.currentMonthElement.textContent = self.utils.monthToStr(self.currentMonth) + " ";
1127
+ self.currentYearElement.value = self.currentYear;
1128
+
1129
+ if (self.config.minDate) {
1130
+ var hidePrevMonthArrow = self.currentYear === self.config.minDate.getFullYear() ? (self.currentMonth + 11) % 12 < self.config.minDate.getMonth() : self.currentYear < self.config.minDate.getFullYear();
1131
+
1132
+ self.prevMonthNav.style.display = hidePrevMonthArrow ? "none" : "block";
1133
+ } else self.prevMonthNav.style.display = "block";
1134
+
1135
+ if (self.config.maxDate) {
1136
+ var hideNextMonthArrow = self.currentYear === self.config.maxDate.getFullYear() ? self.currentMonth + 1 > self.config.maxDate.getMonth() : self.currentYear > self.config.maxDate.getFullYear();
1137
+
1138
+ self.nextMonthNav.style.display = hideNextMonthArrow ? "none" : "block";
1139
+ } else self.nextMonthNav.style.display = "block";
1140
+ }
1141
+
1142
+ function updateValue() {
1143
+ if (!self.selectedDates.length) return self.clear();
1144
+
1145
+ if (self.isMobile) {
1146
+ self.mobileInput.value = self.selectedDates.length ? formatDate(self.mobileFormatStr, latestSelectedDateObj()) : "";
1147
+ }
1148
+
1149
+ var joinChar = self.config.mode !== "range" ? "; " : " to ";
1150
+
1151
+ self.input.value = self.selectedDates.map(function (dObj) {
1152
+ return formatDate(self.config.dateFormat, dObj);
1153
+ }).join(joinChar);
1154
+
1155
+ if (self.config.altInput) {
1156
+ self.altInput.value = self.selectedDates.map(function (dObj) {
1157
+ return formatDate(self.config.altFormat, dObj);
1158
+ }).join(joinChar);
1159
+ }
1160
+
1161
+ triggerEvent("ValueUpdate");
1162
+ }
1163
+
1164
+ function yearScroll(e) {
1165
+ e.preventDefault();
1166
+
1167
+ var delta = Math.max(-1, Math.min(1, e.wheelDelta || -e.deltaY)),
1168
+ newYear = parseInt(e.target.value, 10) + delta;
1169
+
1170
+ handleYearChange(newYear);
1171
+ e.target.value = self.currentYear;
1172
+ }
1173
+
1174
+ function createElement(tag) {
1175
+ var className = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
1176
+ var content = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
1177
+
1178
+ var e = document.createElement(tag);
1179
+ e.className = className;
1180
+
1181
+ if (content) e.textContent = content;
1182
+
1183
+ return e;
1184
+ }
1185
+
1186
+ function debounce(func, wait, immediate) {
1187
+ var timeout = void 0;
1188
+ return function () {
1189
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1190
+ args[_key] = arguments[_key];
1191
+ }
1192
+
1193
+ var context = this;
1194
+ var later = function later() {
1195
+ timeout = null;
1196
+ if (!immediate) func.apply(context, args);
1197
+ };
1198
+
1199
+ clearTimeout(timeout);
1200
+ timeout = setTimeout(later, wait);
1201
+ if (immediate && !timeout) func.apply(context, args);
1202
+ };
1203
+ }
1204
+
1205
+ function equalDates(date1, date2) {
1206
+ if (!(date1 instanceof Date) || !(date2 instanceof Date)) return false;
1207
+ return date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear();
1208
+ }
1209
+
1210
+ function timeWrapper(e) {
1211
+ e.preventDefault();
1212
+ if (e && ((e.target.value || e.target.textContent).length >= 2 || e.type !== "keydown" && e.type !== "input")) e.target.blur();
1213
+
1214
+ if (e.target.className === "flatpickr-am-pm") {
1215
+ e.target.textContent = ["AM", "PM"][e.target.textContent === "AM" | 0];
1216
+ return;
1217
+ }
1218
+
1219
+ var min = parseInt(e.target.min, 10),
1220
+ max = parseInt(e.target.max, 10),
1221
+ step = parseInt(e.target.step, 10),
1222
+ value = parseInt(e.target.value, 10);
1223
+
1224
+ var newValue = value;
1225
+
1226
+ if (e.type === "wheel") newValue = value + step * Math.max(-1, Math.min(1, e.wheelDelta || -e.deltaY));else if (e.type === "keydown") newValue = value + step * (e.which === 38 ? 1 : -1);
1227
+
1228
+ if (newValue <= min) newValue = max - step;else if (newValue >= max) newValue = min + step;
1229
+
1230
+ if (self.amPM && (value === 11 && newValue === 12 || value === 12 && newValue === 11)) self.amPM.textContent = self.amPM.innerHTML === "PM" ? "AM" : "PM";
1231
+
1232
+ e.target.value = self.pad(newValue);
1233
+ }
1234
+
1235
+ init();
1236
+ return self;
1237
+ }
1238
+
1239
+ Flatpickr.defaultConfig = {
1240
+
1241
+ mode: "single",
1242
+
1243
+ /* if true, dates will be parsed, formatted, and displayed in UTC.
1244
+ preloading date strings w/ timezones is recommended but not necessary */
1245
+ utc: false,
1246
+
1247
+ // wrap: see https://chmln.github.io/flatpickr/#strap
1248
+ wrap: false,
1249
+
1250
+ // enables week numbers
1251
+ weekNumbers: false,
1252
+
1253
+ // allow manual datetime input
1254
+ allowInput: false,
1255
+
1256
+ /*
1257
+ clicking on input opens the date(time)picker.
1258
+ disable if you wish to open the calendar manually with .open()
1259
+ */
1260
+ clickOpens: true,
1261
+
1262
+ // display time picker in 24 hour mode
1263
+ time_24hr: false,
1264
+
1265
+ // enables the time picker functionality
1266
+ enableTime: false,
1267
+
1268
+ // noCalendar: true will hide the calendar. use for a time picker along w/ enableTime
1269
+ noCalendar: false,
1270
+
1271
+ // more date format chars at https://chmln.github.io/flatpickr/#dateformat
1272
+ dateFormat: "Y-m-d",
1273
+
1274
+ // altInput - see https://chmln.github.io/flatpickr/#altinput
1275
+ altInput: false,
1276
+
1277
+ // the created altInput element will have this class.
1278
+ altInputClass: "form-control input",
1279
+
1280
+ // same as dateFormat, but for altInput
1281
+ altFormat: "F j, Y", // defaults to e.g. June 10, 2016
1282
+
1283
+ // defaultDate - either a datestring or a date object. used for datetimepicker"s initial value
1284
+ defaultDate: null,
1285
+
1286
+ // the minimum date that user can pick (inclusive)
1287
+ minDate: null,
1288
+
1289
+ // the maximum date that user can pick (inclusive)
1290
+ maxDate: null,
1291
+
1292
+ // dateparser that transforms a given string to a date object
1293
+ parseDate: null,
1294
+
1295
+ getWeek: function getWeek(givenDate) {
1296
+ var date = new Date(givenDate.getTime());
1297
+ date.setHours(0, 0, 0, 0);
1298
+
1299
+ // Thursday in current week decides the year.
1300
+ date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
1301
+ // January 4 is always in week 1.
1302
+ var week1 = new Date(date.getFullYear(), 0, 4);
1303
+ // Adjust to Thursday in week 1 and count number of weeks from date to week1.
1304
+ return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);
1305
+ },
1306
+
1307
+ // see https://chmln.github.io/flatpickr/#disable
1308
+ enable: [],
1309
+
1310
+ // see https://chmln.github.io/flatpickr/#disable
1311
+ disable: [],
1312
+
1313
+ // display the short version of month names - e.g. Sep instead of September
1314
+ shorthandCurrentMonth: false,
1315
+
1316
+ // displays calendar inline. see https://chmln.github.io/flatpickr/#inline-calendar
1317
+ inline: false,
1318
+
1319
+ // position calendar inside wrapper and next to the input element
1320
+ // leave at false unless you know what you"re doing
1321
+ static: false,
1322
+
1323
+ // DOM node to append the calendar to in *static* mode
1324
+ appendTo: null,
1325
+
1326
+ // code for previous/next icons. this is where you put your custom icon code e.g. fontawesome
1327
+ prevArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>",
1328
+ nextArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>",
1329
+
1330
+ // enables seconds in the time picker
1331
+ enableSeconds: false,
1332
+
1333
+ // step size used when scrolling/incrementing the hour element
1334
+ hourIncrement: 1,
1335
+
1336
+ // step size used when scrolling/incrementing the minute element
1337
+ minuteIncrement: 5,
1338
+
1339
+ // initial value in the hour element
1340
+ defaultHour: 12,
1341
+
1342
+ // initial value in the minute element
1343
+ defaultMinute: 0,
1344
+
1345
+ // disable native mobile datetime input support
1346
+ disableMobile: false,
1347
+
1348
+ // default locale
1349
+ locale: "default",
1350
+
1351
+ // onChange callback when user selects a date or time
1352
+ onChange: null, // function (dateObj, dateStr) {}
1353
+
1354
+ // called every time calendar is opened
1355
+ onOpen: null, // function (dateObj, dateStr) {}
1356
+
1357
+ // called every time calendar is closed
1358
+ onClose: null, // function (dateObj, dateStr) {}
1359
+
1360
+ // called after calendar is ready
1361
+ onReady: null, // function (dateObj, dateStr) {}
1362
+
1363
+ onValueUpdate: null,
1364
+
1365
+ onDayCreate: null
1366
+ };
1367
+
1368
+ Flatpickr.l10ns = {
1369
+ en: {
1370
+ weekdays: {
1371
+ shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
1372
+ longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
1373
+ },
1374
+ months: {
1375
+ shorthand: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
1376
+ longhand: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
1377
+ },
1378
+ daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
1379
+ firstDayOfWeek: 0,
1380
+ ordinal: function ordinal(nth) {
1381
+ var s = nth % 100;
1382
+ if (s > 3 && s < 21) return "th";
1383
+ switch (s % 10) {
1384
+ case 1:
1385
+ return "st";
1386
+ case 2:
1387
+ return "nd";
1388
+ case 3:
1389
+ return "rd";
1390
+ default:
1391
+ return "th";
1392
+ }
1393
+ },
1394
+ weekAbbreviation: "Wk",
1395
+ scrollTitle: "Scroll to increment",
1396
+ toggleTitle: "Click to toggle"
1397
+ }
1398
+ };
1399
+
1400
+ Flatpickr.l10ns.default = Flatpickr.l10ns.en;
1401
+
1402
+ Flatpickr.localize = function (l10n) {
1403
+ return _extends(Flatpickr.l10ns.default, l10n || {});
1404
+ };
1405
+
1406
+ Flatpickr.prototype = {
1407
+ pad: function pad(number) {
1408
+ return ("0" + number).slice(-2);
1409
+ }
1410
+ };
1411
+
1412
+ function _flatpickr(nodeList, config) {
1413
+ var instances = [];
1414
+ for (var i = 0; i < nodeList.length; i++) {
1415
+ try {
1416
+ nodeList[i]._flatpickr = new Flatpickr(nodeList[i], config || {});
1417
+ instances.push(nodeList[i]._flatpickr);
1418
+ } catch (e) {
1419
+ console.warn(e, e.stack);
1420
+ }
1421
+ }
1422
+
1423
+ return instances.length === 1 ? instances[0] : instances;
1424
+ }
1425
+ if (typeof HTMLElement !== "undefined") {
1426
+ // browser env
1427
+ HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (config) {
1428
+ return _flatpickr(this, config);
1429
+ };
1430
+
1431
+ HTMLElement.prototype.flatpickr = function (config) {
1432
+ return _flatpickr([this], config);
1433
+ };
1434
+ }
1435
+
1436
+ function flatpickr(selector, config) {
1437
+ return _flatpickr(document.querySelectorAll(selector), config);
1438
+ }
1439
+
1440
+ if (typeof jQuery !== "undefined") {
1441
+ jQuery.fn.flatpickr = function (config) {
1442
+ return _flatpickr(this, config);
1443
+ };
1444
+ }
1445
+
1446
+ Date.prototype.fp_incr = function (days) {
1447
+ return new Date(this.getFullYear(), this.getMonth(), this.getDate() + parseInt(days, 10));
1448
+ };
1449
+
1450
+ Date.prototype.fp_isUTC = false;
1451
+ Date.prototype.fp_toUTC = function () {
1452
+ var newDate = new Date(this.getUTCFullYear(), this.getUTCMonth(), this.getUTCDate(), this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds());
1453
+
1454
+ newDate.fp_isUTC = true;
1455
+ return newDate;
1456
+ };
1457
+
1458
+ // IE9 classList polyfill
1459
+ if (!("classList" in document.documentElement) && Object.defineProperty && typeof HTMLElement !== "undefined") {
1460
+ Object.defineProperty(HTMLElement.prototype, "classList", {
1461
+ get: function get() {
1462
+ var self = this;
1463
+ function update(fn) {
1464
+ return function (value) {
1465
+ var classes = self.className.split(/\s+/),
1466
+ index = classes.indexOf(value);
1467
+
1468
+ fn(classes, index, value);
1469
+ self.className = classes.join(" ");
1470
+ };
1471
+ }
1472
+
1473
+ var ret = {
1474
+ add: update(function (classes, index, value) {
1475
+ if (!~index) classes.push(value);
1476
+ }),
1477
+
1478
+ remove: update(function (classes, index) {
1479
+ if (~index) classes.splice(index, 1);
1480
+ }),
1481
+
1482
+ toggle: update(function (classes, index, value) {
1483
+ if (~index) classes.splice(index, 1);else classes.push(value);
1484
+ }),
1485
+
1486
+ contains: function contains(value) {
1487
+ return !!~self.className.split(/\s+/).indexOf(value);
1488
+ },
1489
+
1490
+ item: function item(i) {
1491
+ return self.className.split(/\s+/)[i] || null;
1492
+ }
1493
+ };
1494
+
1495
+ Object.defineProperty(ret, "length", {
1496
+ get: function get() {
1497
+ return self.className.split(/\s+/).length;
1498
+ }
1499
+ });
1500
+
1501
+ return ret;
1502
+ }
1503
+ });
1504
+ }
1505
+
1506
+ if (typeof module !== "undefined") module.exports = Flatpickr;