flatpickr 4.6.9.0 → 4.6.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/lib/flatpickr/version.rb +1 -1
  3. data/package.json +1 -1
  4. data/vendor/assets/javascripts/flatpickr/l10n/ar-dz.js +61 -0
  5. data/vendor/assets/javascripts/flatpickr/l10n/ar.js +11 -1
  6. data/vendor/assets/javascripts/flatpickr/l10n/at.js +1 -0
  7. data/vendor/assets/javascripts/flatpickr/l10n/cat.js +1 -0
  8. data/vendor/assets/javascripts/flatpickr/l10n/ckb.js +68 -0
  9. data/vendor/assets/javascripts/flatpickr/l10n/fi.js +32 -32
  10. data/vendor/assets/javascripts/flatpickr/l10n/gr.js +6 -2
  11. data/vendor/assets/javascripts/flatpickr/l10n/hy.js +86 -0
  12. data/vendor/assets/javascripts/flatpickr/l10n/index.js +434 -222
  13. data/vendor/assets/javascripts/flatpickr/l10n/ko.js +1 -0
  14. data/vendor/assets/javascripts/flatpickr/l10n/ms.js +2 -2
  15. data/vendor/assets/javascripts/flatpickr/l10n/nn.js +73 -0
  16. data/vendor/assets/javascripts/flatpickr/l10n/sv.js +33 -32
  17. data/vendor/assets/javascripts/flatpickr/plugins/confirmDate/confirmDate.js +5 -1
  18. data/vendor/assets/javascripts/flatpickr/plugins/minMaxTimePlugin.js +23 -4
  19. data/vendor/assets/javascripts/flatpickr/plugins/monthSelect/index.js +103 -42
  20. data/vendor/assets/javascripts/flatpickr/plugins/rangePlugin.js +8 -0
  21. data/vendor/assets/javascripts/flatpickr/plugins/scrollPlugin.js +22 -14
  22. data/vendor/assets/javascripts/flatpickr.js +143 -92
  23. data/vendor/assets/stylesheets/flatpickr/plugins/monthSelect/style.css +45 -7
  24. data/vendor/assets/stylesheets/flatpickr/themes/airbnb.css +4 -0
  25. data/vendor/assets/stylesheets/flatpickr/themes/confetti.css +4 -0
  26. data/vendor/assets/stylesheets/flatpickr/themes/dark.css +4 -0
  27. data/vendor/assets/stylesheets/flatpickr/themes/light.css +4 -0
  28. data/vendor/assets/stylesheets/flatpickr/themes/material_blue.css +4 -0
  29. data/vendor/assets/stylesheets/flatpickr/themes/material_green.css +4 -0
  30. data/vendor/assets/stylesheets/flatpickr/themes/material_orange.css +4 -0
  31. data/vendor/assets/stylesheets/flatpickr/themes/material_red.css +4 -0
  32. data/vendor/assets/stylesheets/flatpickr.css +4 -0
  33. metadata +5 -1
@@ -1,4 +1,4 @@
1
- /* flatpickr v4.6.9, @license MIT */
1
+ /* flatpickr v4.6.10, @license MIT */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -208,8 +208,9 @@
208
208
  var t;
209
209
  return function () {
210
210
  var _this = this;
211
+ var args = arguments;
211
212
  clearTimeout(t);
212
- t = setTimeout(function () { return fn.apply(_this, arguments); }, wait);
213
+ t = setTimeout(function () { return fn.apply(_this, args); }, wait);
213
214
  };
214
215
  }
215
216
  var arrayify = function (obj) {
@@ -279,7 +280,7 @@
279
280
  dateObj.setMonth(locale.months.longhand.indexOf(monthName));
280
281
  },
281
282
  G: function (dateObj, hour) {
282
- dateObj.setHours(parseFloat(hour));
283
+ dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour));
283
284
  },
284
285
  H: function (dateObj, hour) {
285
286
  dateObj.setHours(parseFloat(hour));
@@ -312,7 +313,7 @@
312
313
  dateObj.setDate(parseFloat(day));
313
314
  },
314
315
  h: function (dateObj, hour) {
315
- dateObj.setHours(parseFloat(hour));
316
+ dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour));
316
317
  },
317
318
  i: function (dateObj, minutes) {
318
319
  dateObj.setMinutes(parseFloat(minutes));
@@ -339,13 +340,13 @@
339
340
  },
340
341
  };
341
342
  var tokenRegex = {
342
- D: "(\\w+)",
343
- F: "(\\w+)",
343
+ D: "",
344
+ F: "",
344
345
  G: "(\\d\\d|\\d)",
345
346
  H: "(\\d\\d|\\d)",
346
347
  J: "(\\d\\d|\\d)\\w+",
347
348
  K: "",
348
- M: "(\\w+)",
349
+ M: "",
349
350
  S: "(\\d\\d|\\d)",
350
351
  U: "(.+)",
351
352
  W: "(\\d\\d|\\d)",
@@ -355,7 +356,7 @@
355
356
  h: "(\\d\\d|\\d)",
356
357
  i: "(\\d\\d|\\d)",
357
358
  j: "(\\d\\d|\\d)",
358
- l: "(\\w+)",
359
+ l: "",
359
360
  m: "(\\d\\d|\\d)",
360
361
  n: "(\\d\\d|\\d)",
361
362
  s: "(\\d\\d|\\d)",
@@ -469,17 +470,15 @@
469
470
  parsedDate = new Date();
470
471
  timeless = true;
471
472
  }
473
+ else if (config && config.parseDate) {
474
+ parsedDate = config.parseDate(date, format);
475
+ }
472
476
  else if (/Z$/.test(datestr) ||
473
477
  /GMT$/.test(datestr) // datestrings w/ timezone
474
- )
478
+ ) {
475
479
  parsedDate = new Date(date);
476
- else if (config && config.parseDate)
477
- parsedDate = config.parseDate(date, format);
480
+ }
478
481
  else {
479
- parsedDate =
480
- !config || !config.noCalendar
481
- ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)
482
- : new Date(new Date().setHours(0, 0, 0, 0));
483
482
  var matched = void 0, ops = [];
484
483
  for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) {
485
484
  var token_1 = format[i];
@@ -497,11 +496,15 @@
497
496
  }
498
497
  else if (!isBackSlash)
499
498
  regexStr += "."; // don't really care
500
- ops.forEach(function (_a) {
501
- var fn = _a.fn, val = _a.val;
502
- return (parsedDate = fn(parsedDate, val, locale) || parsedDate);
503
- });
504
499
  }
500
+ parsedDate =
501
+ !config || !config.noCalendar
502
+ ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0)
503
+ : new Date(new Date().setHours(0, 0, 0, 0));
504
+ ops.forEach(function (_a) {
505
+ var fn = _a.fn, val = _a.val;
506
+ return (parsedDate = fn(parsedDate, val, locale) || parsedDate);
507
+ });
505
508
  parsedDate = matched ? parsedDate : undefined;
506
509
  }
507
510
  }
@@ -529,6 +532,13 @@
529
532
  var isBetween = function (ts, ts1, ts2) {
530
533
  return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2);
531
534
  };
535
+ var calculateSecondsSinceMidnight = function (hours, minutes, seconds) {
536
+ return hours * 3600 + minutes * 60 + seconds;
537
+ };
538
+ var parseSeconds = function (secondsSinceMidnight) {
539
+ var hours = Math.floor(secondsSinceMidnight / 3600), minutes = (secondsSinceMidnight - hours * 3600) / 60;
540
+ return [hours, minutes, secondsSinceMidnight - hours * 3600 - minutes * 60];
541
+ };
532
542
  var duration = {
533
543
  DAY: 86400000,
534
544
  };
@@ -600,10 +610,13 @@
600
610
  self.changeYear = changeYear;
601
611
  self.clear = clear;
602
612
  self.close = close;
613
+ self.onMouseOver = onMouseOver;
603
614
  self._createElement = createElement;
615
+ self.createDay = createDay;
604
616
  self.destroy = destroy;
605
617
  self.isEnabled = isEnabled;
606
618
  self.jumpToDate = jumpToDate;
619
+ self.updateValue = updateValue;
607
620
  self.open = open;
608
621
  self.redraw = redraw;
609
622
  self.set = set;
@@ -652,6 +665,10 @@
652
665
  }
653
666
  triggerEvent("onReady");
654
667
  }
668
+ function getClosestActiveElement() {
669
+ var _a;
670
+ return ((_a = self.calendarContainer) === null || _a === void 0 ? void 0 : _a.getRootNode()).activeElement || document.activeElement;
671
+ }
655
672
  function bindToInstance(fn) {
656
673
  return fn.bind(self);
657
674
  }
@@ -698,10 +715,17 @@
698
715
  if (e !== undefined && e.type !== "blur") {
699
716
  timeWrapper(e);
700
717
  }
701
- var prevValue = self._input.value;
702
- setHoursFromInputs();
718
+ var valueFromInput = self._input.value;
719
+ var dateFromInput = self.parseDate(valueFromInput);
720
+ var latestDate = self.latestSelectedDateObj;
721
+ if (valueFromInput && latestDate && (dateFromInput === null || dateFromInput === void 0 ? void 0 : dateFromInput.getTime()) !== (latestDate === null || latestDate === void 0 ? void 0 : latestDate.getTime())) {
722
+ setDate(dateFromInput);
723
+ }
724
+ else {
725
+ setHoursFromInputs();
726
+ }
703
727
  updateValue();
704
- if (self._input.value !== prevValue) {
728
+ if (self._input.value !== valueFromInput) {
705
729
  self._debouncedChange();
706
730
  }
707
731
  }
@@ -741,25 +765,40 @@
741
765
  self.latestSelectedDateObj &&
742
766
  compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===
743
767
  0);
744
- if (limitMaxHours) {
745
- var maxTime = self.config.maxTime !== undefined
746
- ? self.config.maxTime
747
- : self.config.maxDate;
748
- hours = Math.min(hours, maxTime.getHours());
749
- if (hours === maxTime.getHours())
750
- minutes = Math.min(minutes, maxTime.getMinutes());
751
- if (minutes === maxTime.getMinutes())
752
- seconds = Math.min(seconds, maxTime.getSeconds());
753
- }
754
- if (limitMinHours) {
755
- var minTime = self.config.minTime !== undefined
756
- ? self.config.minTime
757
- : self.config.minDate;
758
- hours = Math.max(hours, minTime.getHours());
759
- if (hours === minTime.getHours() && minutes < minTime.getMinutes())
760
- minutes = minTime.getMinutes();
761
- if (minutes === minTime.getMinutes())
762
- seconds = Math.max(seconds, minTime.getSeconds());
768
+ if (self.config.maxTime !== undefined &&
769
+ self.config.minTime !== undefined &&
770
+ self.config.minTime > self.config.maxTime) {
771
+ var minBound = calculateSecondsSinceMidnight(self.config.minTime.getHours(), self.config.minTime.getMinutes(), self.config.minTime.getSeconds());
772
+ var maxBound = calculateSecondsSinceMidnight(self.config.maxTime.getHours(), self.config.maxTime.getMinutes(), self.config.maxTime.getSeconds());
773
+ var currentTime = calculateSecondsSinceMidnight(hours, minutes, seconds);
774
+ if (currentTime > maxBound && currentTime < minBound) {
775
+ var result = parseSeconds(minBound);
776
+ hours = result[0];
777
+ minutes = result[1];
778
+ seconds = result[2];
779
+ }
780
+ }
781
+ else {
782
+ if (limitMaxHours) {
783
+ var maxTime = self.config.maxTime !== undefined
784
+ ? self.config.maxTime
785
+ : self.config.maxDate;
786
+ hours = Math.min(hours, maxTime.getHours());
787
+ if (hours === maxTime.getHours())
788
+ minutes = Math.min(minutes, maxTime.getMinutes());
789
+ if (minutes === maxTime.getMinutes())
790
+ seconds = Math.min(seconds, maxTime.getSeconds());
791
+ }
792
+ if (limitMinHours) {
793
+ var minTime = self.config.minTime !== undefined
794
+ ? self.config.minTime
795
+ : self.config.minDate;
796
+ hours = Math.max(hours, minTime.getHours());
797
+ if (hours === minTime.getHours() && minutes < minTime.getMinutes())
798
+ minutes = minTime.getMinutes();
799
+ if (minutes === minTime.getMinutes())
800
+ seconds = Math.max(seconds, minTime.getSeconds());
801
+ }
763
802
  }
764
803
  setHours(hours, minutes, seconds);
765
804
  }
@@ -821,7 +860,7 @@
821
860
  return element.forEach(function (el) { return bind(el, event, handler, options); });
822
861
  element.addEventListener(event, handler, options);
823
862
  self._handlers.push({
824
- remove: function () { return element.removeEventListener(event, handler); },
863
+ remove: function () { return element.removeEventListener(event, handler, options); },
825
864
  });
826
865
  }
827
866
  function triggerChange() {
@@ -849,7 +888,10 @@
849
888
  if (self.config.mode === "range")
850
889
  onMouseOver(getEventTarget(e));
851
890
  });
852
- bind(window.document.body, "keydown", onKeyDown);
891
+ bind(self._input, "keydown", onKeyDown);
892
+ if (self.calendarContainer !== undefined) {
893
+ bind(self.calendarContainer, "keydown", onKeyDown);
894
+ }
853
895
  if (!self.config.inline && !self.config.static)
854
896
  bind(window, "resize", debouncedResize);
855
897
  if (window.ontouchstart !== undefined)
@@ -881,7 +923,6 @@
881
923
  if (self.amPM !== undefined) {
882
924
  bind(self.amPM, "click", function (e) {
883
925
  updateTime(e);
884
- triggerChange();
885
926
  });
886
927
  }
887
928
  }
@@ -1009,7 +1050,7 @@
1009
1050
  : window.document.body).appendChild(self.calendarContainer);
1010
1051
  }
1011
1052
  function createDay(className, date, dayNumber, i) {
1012
- var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", "flatpickr-day " + className, date.getDate().toString());
1053
+ var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", className, date.getDate().toString());
1013
1054
  dayElement.dateObj = date;
1014
1055
  dayElement.$i = i;
1015
1056
  dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat));
@@ -1097,11 +1138,12 @@
1097
1138
  return undefined;
1098
1139
  }
1099
1140
  function focusOnDay(current, offset) {
1100
- var dayFocused = isInView(document.activeElement || document.body);
1141
+ var activeElement = getClosestActiveElement();
1142
+ var dayFocused = isInView(activeElement || document.body);
1101
1143
  var startElem = current !== undefined
1102
1144
  ? current
1103
1145
  : dayFocused
1104
- ? document.activeElement
1146
+ ? activeElement
1105
1147
  : self.selectedDateElem !== undefined && isInView(self.selectedDateElem)
1106
1148
  ? self.selectedDateElem
1107
1149
  : self.todayDateElem !== undefined && isInView(self.todayDateElem)
@@ -1124,16 +1166,16 @@
1124
1166
  var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0;
1125
1167
  // prepend days from the ending of previous month
1126
1168
  for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) {
1127
- days.appendChild(createDay(prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));
1169
+ days.appendChild(createDay("flatpickr-day " + prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex));
1128
1170
  }
1129
1171
  // Start at 1 since there is no 0th day
1130
1172
  for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) {
1131
- days.appendChild(createDay("", new Date(year, month, dayNumber), dayNumber, dayIndex));
1173
+ days.appendChild(createDay("flatpickr-day", new Date(year, month, dayNumber), dayNumber, dayIndex));
1132
1174
  }
1133
1175
  // append days from the next month
1134
1176
  for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth &&
1135
1177
  (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) {
1136
- days.appendChild(createDay(nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));
1178
+ days.appendChild(createDay("flatpickr-day " + nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex));
1137
1179
  }
1138
1180
  //updateNavigationCurrentMonth();
1139
1181
  var dayContainer = createElement("div", "dayContainer");
@@ -1504,8 +1546,6 @@
1504
1546
  });
1505
1547
  }
1506
1548
  function isCalendarElem(elem) {
1507
- if (self.config.appendTo && self.config.appendTo.contains(elem))
1508
- return true;
1509
1549
  return self.calendarContainer.contains(elem);
1510
1550
  }
1511
1551
  function documentClick(e) {
@@ -1532,6 +1572,11 @@
1532
1572
  return elem.contains(eventTarget_1);
1533
1573
  });
1534
1574
  if (lostFocus && isIgnored) {
1575
+ if (self.config.allowInput) {
1576
+ self.setDate(self._input.value, true, self.config.altInput
1577
+ ? self.config.altFormat
1578
+ : self.config.dateFormat);
1579
+ }
1535
1580
  if (self.timeContainer !== undefined &&
1536
1581
  self.minuteElement !== undefined &&
1537
1582
  self.hourElement !== undefined &&
@@ -1542,10 +1587,8 @@
1542
1587
  self.close();
1543
1588
  if (self.config &&
1544
1589
  self.config.mode === "range" &&
1545
- self.selectedDates.length === 1) {
1590
+ self.selectedDates.length === 1)
1546
1591
  self.clear(false);
1547
- self.redraw();
1548
- }
1549
1592
  }
1550
1593
  }
1551
1594
  }
@@ -1656,6 +1699,7 @@
1656
1699
  self.setDate(self._input.value, true, eventTarget === self.altInput
1657
1700
  ? self.config.altFormat
1658
1701
  : self.config.dateFormat);
1702
+ self.close();
1659
1703
  return eventTarget.blur();
1660
1704
  }
1661
1705
  else {
@@ -1692,9 +1736,10 @@
1692
1736
  case 39:
1693
1737
  if (!isTimeObj && !isInput) {
1694
1738
  e.preventDefault();
1739
+ var activeElement = getClosestActiveElement();
1695
1740
  if (self.daysContainer !== undefined &&
1696
1741
  (allowInput === false ||
1697
- (document.activeElement && isInView(document.activeElement)))) {
1742
+ (activeElement && isInView(activeElement)))) {
1698
1743
  var delta_1 = e.keyCode === 39 ? 1 : -1;
1699
1744
  if (!e.ctrlKey)
1700
1745
  focusOnDay(undefined, delta_1);
@@ -1781,10 +1826,11 @@
1781
1826
  triggerEvent("onKeyDown", e);
1782
1827
  }
1783
1828
  }
1784
- function onMouseOver(elem) {
1829
+ function onMouseOver(elem, cellClass) {
1830
+ if (cellClass === void 0) { cellClass = "flatpickr-day"; }
1785
1831
  if (self.selectedDates.length !== 1 ||
1786
1832
  (elem &&
1787
- (!elem.classList.contains("flatpickr-day") ||
1833
+ (!elem.classList.contains(cellClass) ||
1788
1834
  elem.classList.contains("flatpickr-disabled"))))
1789
1835
  return;
1790
1836
  var hoverDate = elem
@@ -1802,43 +1848,38 @@
1802
1848
  maxRange = t;
1803
1849
  }
1804
1850
  }
1805
- for (var m = 0; m < self.config.showMonths; m++) {
1806
- var month = self.daysContainer.children[m];
1807
- var _loop_1 = function (i, l) {
1808
- var dayElem = month.children[i], date = dayElem.dateObj;
1809
- var timestamp = date.getTime();
1810
- var outOfRange = (minRange > 0 && timestamp < minRange) ||
1811
- (maxRange > 0 && timestamp > maxRange);
1812
- if (outOfRange) {
1813
- dayElem.classList.add("notAllowed");
1814
- ["inRange", "startRange", "endRange"].forEach(function (c) {
1815
- dayElem.classList.remove(c);
1816
- });
1817
- return "continue";
1818
- }
1819
- else if (containsDisabled && !outOfRange)
1820
- return "continue";
1821
- ["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) {
1851
+ var hoverableCells = Array.from(self.rContainer.querySelectorAll("*:nth-child(-n+" + self.config.showMonths + ") > ." + cellClass));
1852
+ hoverableCells.forEach(function (dayElem) {
1853
+ var date = dayElem.dateObj;
1854
+ var timestamp = date.getTime();
1855
+ var outOfRange = (minRange > 0 && timestamp < minRange) ||
1856
+ (maxRange > 0 && timestamp > maxRange);
1857
+ if (outOfRange) {
1858
+ dayElem.classList.add("notAllowed");
1859
+ ["inRange", "startRange", "endRange"].forEach(function (c) {
1822
1860
  dayElem.classList.remove(c);
1823
1861
  });
1824
- if (elem !== undefined) {
1825
- elem.classList.add(hoverDate <= self.selectedDates[0].getTime()
1826
- ? "startRange"
1827
- : "endRange");
1828
- if (initialDate < hoverDate && timestamp === initialDate)
1829
- dayElem.classList.add("startRange");
1830
- else if (initialDate > hoverDate && timestamp === initialDate)
1831
- dayElem.classList.add("endRange");
1832
- if (timestamp >= minRange &&
1833
- (maxRange === 0 || timestamp <= maxRange) &&
1834
- isBetween(timestamp, initialDate, hoverDate))
1835
- dayElem.classList.add("inRange");
1836
- }
1837
- };
1838
- for (var i = 0, l = month.children.length; i < l; i++) {
1839
- _loop_1(i, l);
1862
+ return;
1840
1863
  }
1841
- }
1864
+ else if (containsDisabled && !outOfRange)
1865
+ return;
1866
+ ["startRange", "inRange", "endRange", "notAllowed"].forEach(function (c) {
1867
+ dayElem.classList.remove(c);
1868
+ });
1869
+ if (elem !== undefined) {
1870
+ elem.classList.add(hoverDate <= self.selectedDates[0].getTime()
1871
+ ? "startRange"
1872
+ : "endRange");
1873
+ if (initialDate < hoverDate && timestamp === initialDate)
1874
+ dayElem.classList.add("startRange");
1875
+ else if (initialDate > hoverDate && timestamp === initialDate)
1876
+ dayElem.classList.add("endRange");
1877
+ if (timestamp >= minRange &&
1878
+ (maxRange === 0 || timestamp <= maxRange) &&
1879
+ isBetween(timestamp, initialDate, hoverDate))
1880
+ dayElem.classList.add("inRange");
1881
+ }
1882
+ });
1842
1883
  }
1843
1884
  function onResize() {
1844
1885
  if (self.isOpen && !self.config.static && !self.config.inline)
@@ -2031,6 +2072,10 @@
2031
2072
  : self.config.locale !== "default"
2032
2073
  ? flatpickr.l10ns[self.config.locale]
2033
2074
  : undefined));
2075
+ tokenRegex.D = "(" + self.l10n.weekdays.shorthand.join("|") + ")";
2076
+ tokenRegex.l = "(" + self.l10n.weekdays.longhand.join("|") + ")";
2077
+ tokenRegex.M = "(" + self.l10n.months.shorthand.join("|") + ")";
2078
+ tokenRegex.F = "(" + self.l10n.months.longhand.join("|") + ")";
2034
2079
  tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")";
2035
2080
  var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {})));
2036
2081
  if (userConfig.time_24hr === undefined &&
@@ -2111,6 +2156,8 @@
2111
2156
  var editableSheet = null;
2112
2157
  for (var i = 0; i < document.styleSheets.length; i++) {
2113
2158
  var sheet = document.styleSheets[i];
2159
+ if (!sheet.cssRules)
2160
+ continue;
2114
2161
  try {
2115
2162
  sheet.cssRules;
2116
2163
  }
@@ -2224,6 +2271,7 @@
2224
2271
  showMonths: [buildMonths, setCalendarWidth, buildWeekdays],
2225
2272
  minDate: [jumpToDate],
2226
2273
  maxDate: [jumpToDate],
2274
+ positionElement: [updatePositionElement],
2227
2275
  clickOpens: [
2228
2276
  function () {
2229
2277
  if (self.config.clickOpens === true) {
@@ -2395,6 +2443,9 @@
2395
2443
  }
2396
2444
  if (!self.config.allowInput)
2397
2445
  self._input.setAttribute("readonly", "readonly");
2446
+ updatePositionElement();
2447
+ }
2448
+ function updatePositionElement() {
2398
2449
  self._positionElement = self.config.positionElement || self._input;
2399
2450
  }
2400
2451
  function setupMobile() {
@@ -5,8 +5,8 @@
5
5
 
6
6
  .flatpickr-monthSelect-month {
7
7
  background: none;
8
- border: 0;
9
- border-radius: 2px;
8
+ border: 1px solid transparent;
9
+ border-radius: 4px;
10
10
  -webkit-box-sizing: border-box;
11
11
  box-sizing: border-box;
12
12
  color: #393939;
@@ -24,12 +24,12 @@
24
24
  width: 33%;
25
25
  }
26
26
 
27
- .flatpickr-monthSelect-month.disabled {
27
+ .flatpickr-monthSelect-month.flatpickr-disabled {
28
28
  color: #eee;
29
29
  }
30
30
 
31
- .flatpickr-monthSelect-month.disabled:hover,
32
- .flatpickr-monthSelect-month.disabled:focus {
31
+ .flatpickr-monthSelect-month.flatpickr-disabled:hover,
32
+ .flatpickr-monthSelect-month.flatpickr-disabled:focus {
33
33
  cursor: not-allowed;
34
34
  background: none !important;
35
35
  }
@@ -52,25 +52,63 @@
52
52
  color: rgba(255, 255, 255, 0.95);
53
53
  }
54
54
 
55
+ .flatpickr-monthSelect-month.today {
56
+ border-color: #959ea9;
57
+ }
58
+
59
+ .flatpickr-monthSelect-month.inRange,
60
+ .flatpickr-monthSelect-month.inRange.today,
55
61
  .flatpickr-monthSelect-month:hover,
56
62
  .flatpickr-monthSelect-month:focus {
57
63
  background: #e6e6e6;
58
64
  cursor: pointer;
59
65
  outline: 0;
66
+ border-color: #e6e6e6;
60
67
  }
61
68
 
69
+ .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.inRange,
62
70
  .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:hover,
63
71
  .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:focus {
64
72
  background: #646c8c;
65
73
  border-color: #646c8c;
66
74
  }
67
75
 
68
- .flatpickr-monthSelect-month.selected {
76
+ .flatpickr-monthSelect-month.today:hover,
77
+ .flatpickr-monthSelect-month.today:focus {
78
+ background: #959ea9;
79
+ border-color: #959ea9;
80
+ color: #fff;
81
+ }
82
+
83
+ .flatpickr-monthSelect-month.selected,
84
+ .flatpickr-monthSelect-month.startRange,
85
+ .flatpickr-monthSelect-month.endRange {
69
86
  background-color: #569ff7;
87
+ box-shadow: none;
70
88
  color: #fff;
89
+ border-color: #569ff7;
90
+ }
91
+
92
+ .flatpickr-monthSelect-month.startRange {
93
+ border-radius: 50px 0 0 50px;
94
+ }
95
+
96
+ .flatpickr-monthSelect-month.endRange {
97
+ border-radius: 0 50px 50px 0;
98
+ }
99
+
100
+ .flatpickr-monthSelect-month.startRange.endRange {
101
+ border-radius: 50px;
102
+ }
103
+
104
+ .flatpickr-monthSelect-month.inRange {
105
+ border-radius: 0;
106
+ box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;
71
107
  }
72
108
 
73
- .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.selected {
109
+ .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.selected,
110
+ .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.startRange,
111
+ .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.endRange {
74
112
  background: #80cbc4;
75
113
  -webkit-box-shadow: none;
76
114
  box-shadow: none;
@@ -157,6 +157,10 @@
157
157
  }
158
158
  .flatpickr-months .flatpickr-prev-month,
159
159
  .flatpickr-months .flatpickr-next-month {
160
+ -webkit-user-select: none;
161
+ -moz-user-select: none;
162
+ -ms-user-select: none;
163
+ user-select: none;
160
164
  text-decoration: none;
161
165
  cursor: pointer;
162
166
  position: absolute;
@@ -163,6 +163,10 @@
163
163
  }
164
164
  .flatpickr-months .flatpickr-prev-month,
165
165
  .flatpickr-months .flatpickr-next-month {
166
+ -webkit-user-select: none;
167
+ -moz-user-select: none;
168
+ -ms-user-select: none;
169
+ user-select: none;
166
170
  text-decoration: none;
167
171
  cursor: pointer;
168
172
  position: absolute;
@@ -157,6 +157,10 @@
157
157
  }
158
158
  .flatpickr-months .flatpickr-prev-month,
159
159
  .flatpickr-months .flatpickr-next-month {
160
+ -webkit-user-select: none;
161
+ -moz-user-select: none;
162
+ -ms-user-select: none;
163
+ user-select: none;
160
164
  text-decoration: none;
161
165
  cursor: pointer;
162
166
  position: absolute;
@@ -163,6 +163,10 @@
163
163
  }
164
164
  .flatpickr-months .flatpickr-prev-month,
165
165
  .flatpickr-months .flatpickr-next-month {
166
+ -webkit-user-select: none;
167
+ -moz-user-select: none;
168
+ -ms-user-select: none;
169
+ user-select: none;
166
170
  text-decoration: none;
167
171
  cursor: pointer;
168
172
  position: absolute;
@@ -163,6 +163,10 @@
163
163
  }
164
164
  .flatpickr-months .flatpickr-prev-month,
165
165
  .flatpickr-months .flatpickr-next-month {
166
+ -webkit-user-select: none;
167
+ -moz-user-select: none;
168
+ -ms-user-select: none;
169
+ user-select: none;
166
170
  text-decoration: none;
167
171
  cursor: pointer;
168
172
  position: absolute;
@@ -163,6 +163,10 @@
163
163
  }
164
164
  .flatpickr-months .flatpickr-prev-month,
165
165
  .flatpickr-months .flatpickr-next-month {
166
+ -webkit-user-select: none;
167
+ -moz-user-select: none;
168
+ -ms-user-select: none;
169
+ user-select: none;
166
170
  text-decoration: none;
167
171
  cursor: pointer;
168
172
  position: absolute;
@@ -163,6 +163,10 @@
163
163
  }
164
164
  .flatpickr-months .flatpickr-prev-month,
165
165
  .flatpickr-months .flatpickr-next-month {
166
+ -webkit-user-select: none;
167
+ -moz-user-select: none;
168
+ -ms-user-select: none;
169
+ user-select: none;
166
170
  text-decoration: none;
167
171
  cursor: pointer;
168
172
  position: absolute;
@@ -163,6 +163,10 @@
163
163
  }
164
164
  .flatpickr-months .flatpickr-prev-month,
165
165
  .flatpickr-months .flatpickr-next-month {
166
+ -webkit-user-select: none;
167
+ -moz-user-select: none;
168
+ -ms-user-select: none;
169
+ user-select: none;
166
170
  text-decoration: none;
167
171
  cursor: pointer;
168
172
  position: absolute;
@@ -157,6 +157,10 @@
157
157
  }
158
158
  .flatpickr-months .flatpickr-prev-month,
159
159
  .flatpickr-months .flatpickr-next-month {
160
+ -webkit-user-select: none;
161
+ -moz-user-select: none;
162
+ -ms-user-select: none;
163
+ user-select: none;
160
164
  text-decoration: none;
161
165
  cursor: pointer;
162
166
  position: absolute;