flatpickr 4.5.2.0 → 4.5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -14
  3. data/lib/flatpickr/version.rb +1 -1
  4. data/vendor/assets/javascripts/flatpickr.js +2065 -2106
  5. data/vendor/assets/javascripts/flatpickr/l10n/ar.js +12 -35
  6. data/vendor/assets/javascripts/flatpickr/l10n/at.js +17 -53
  7. data/vendor/assets/javascripts/flatpickr/l10n/be.js +22 -58
  8. data/vendor/assets/javascripts/flatpickr/l10n/bg.js +12 -48
  9. data/vendor/assets/javascripts/flatpickr/l10n/bn.js +12 -48
  10. data/vendor/assets/javascripts/flatpickr/l10n/cat.js +34 -66
  11. data/vendor/assets/javascripts/flatpickr/l10n/cs.js +22 -58
  12. data/vendor/assets/javascripts/flatpickr/l10n/cy.js +23 -75
  13. data/vendor/assets/javascripts/flatpickr/l10n/da.js +18 -54
  14. data/vendor/assets/javascripts/flatpickr/l10n/de.js +17 -53
  15. data/vendor/assets/javascripts/flatpickr/l10n/default.js +35 -66
  16. data/vendor/assets/javascripts/flatpickr/l10n/eo.js +20 -56
  17. data/vendor/assets/javascripts/flatpickr/l10n/es.js +17 -53
  18. data/vendor/assets/javascripts/flatpickr/l10n/et.js +20 -56
  19. data/vendor/assets/javascripts/flatpickr/l10n/fa.js +16 -52
  20. data/vendor/assets/javascripts/flatpickr/l10n/fi.js +16 -52
  21. data/vendor/assets/javascripts/flatpickr/l10n/fr.js +21 -58
  22. data/vendor/assets/javascripts/flatpickr/l10n/gr.js +21 -57
  23. data/vendor/assets/javascripts/flatpickr/l10n/he.js +12 -40
  24. data/vendor/assets/javascripts/flatpickr/l10n/hi.js +12 -48
  25. data/vendor/assets/javascripts/flatpickr/l10n/hr.js +13 -49
  26. data/vendor/assets/javascripts/flatpickr/l10n/hu.js +19 -55
  27. data/vendor/assets/javascripts/flatpickr/l10n/id.js +16 -44
  28. data/vendor/assets/javascripts/flatpickr/l10n/index.js +963 -2805
  29. data/vendor/assets/javascripts/flatpickr/l10n/it.js +20 -54
  30. data/vendor/assets/javascripts/flatpickr/l10n/ja.js +12 -48
  31. data/vendor/assets/javascripts/flatpickr/l10n/km.js +21 -57
  32. data/vendor/assets/javascripts/flatpickr/l10n/ko.js +15 -51
  33. data/vendor/assets/javascripts/flatpickr/l10n/kz.js +22 -58
  34. data/vendor/assets/javascripts/flatpickr/l10n/lt.js +19 -55
  35. data/vendor/assets/javascripts/flatpickr/l10n/lv.js +14 -50
  36. data/vendor/assets/javascripts/flatpickr/l10n/mk.js +15 -51
  37. data/vendor/assets/javascripts/flatpickr/l10n/mn.js +14 -42
  38. data/vendor/assets/javascripts/flatpickr/l10n/ms.js +16 -52
  39. data/vendor/assets/javascripts/flatpickr/l10n/my.js +16 -52
  40. data/vendor/assets/javascripts/flatpickr/l10n/nl.js +21 -58
  41. data/vendor/assets/javascripts/flatpickr/l10n/no.js +20 -56
  42. data/vendor/assets/javascripts/flatpickr/l10n/pa.js +12 -48
  43. data/vendor/assets/javascripts/flatpickr/l10n/pl.js +20 -56
  44. data/vendor/assets/javascripts/flatpickr/l10n/pt.js +13 -49
  45. data/vendor/assets/javascripts/flatpickr/l10n/ro.js +16 -52
  46. data/vendor/assets/javascripts/flatpickr/l10n/ru.js +22 -58
  47. data/vendor/assets/javascripts/flatpickr/l10n/si.js +12 -48
  48. data/vendor/assets/javascripts/flatpickr/l10n/sk.js +17 -53
  49. data/vendor/assets/javascripts/flatpickr/l10n/sl.js +17 -53
  50. data/vendor/assets/javascripts/flatpickr/l10n/sq.js +12 -48
  51. data/vendor/assets/javascripts/flatpickr/l10n/sr.js +15 -51
  52. data/vendor/assets/javascripts/flatpickr/l10n/sv.js +17 -53
  53. data/vendor/assets/javascripts/flatpickr/l10n/th.js +19 -55
  54. data/vendor/assets/javascripts/flatpickr/l10n/tr.js +21 -57
  55. data/vendor/assets/javascripts/flatpickr/l10n/uk.js +13 -49
  56. data/vendor/assets/javascripts/flatpickr/l10n/vn.js +13 -49
  57. data/vendor/assets/javascripts/flatpickr/l10n/zh.js +16 -52
  58. data/vendor/assets/javascripts/flatpickr/plugins/confirmDate/confirmDate.js +32 -35
  59. data/vendor/assets/javascripts/flatpickr/plugins/labelPlugin/labelPlugin.js +18 -17
  60. data/vendor/assets/javascripts/flatpickr/plugins/minMaxTimePlugin.js +262 -251
  61. data/vendor/assets/javascripts/flatpickr/plugins/monthSelect/monthSelect.js +46 -63
  62. data/vendor/assets/javascripts/flatpickr/plugins/rangePlugin.js +134 -125
  63. data/vendor/assets/javascripts/flatpickr/plugins/scrollPlugin.js +44 -31
  64. data/vendor/assets/javascripts/flatpickr/plugins/weekSelect/weekSelect.js +63 -66
  65. metadata +3 -4
@@ -5,63 +5,27 @@
5
5
  (factory((global.tr = {})));
6
6
  }(this, (function (exports) { 'use strict';
7
7
 
8
- const fp = typeof window !== "undefined" && window.flatpickr !== undefined
9
- ? window.flatpickr
10
- : {
11
- l10ns: {},
12
- };
13
- const Turkish = {
14
- weekdays: {
15
- shorthand: ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"],
16
- longhand: [
17
- "Pazar",
18
- "Pazartesi",
19
- "Salı",
20
- "Çarşamba",
21
- "Perşembe",
22
- "Cuma",
23
- "Cumartesi",
24
- ],
25
- },
26
- months: {
27
- shorthand: [
28
- "Oca",
29
- "Şub",
30
- "Mar",
31
- "Nis",
32
- "May",
33
- "Haz",
34
- "Tem",
35
- "Ağu",
36
- "Eyl",
37
- "Eki",
38
- "Kas",
39
- "Ara",
40
- ],
41
- longhand: [
42
- "Ocak",
43
- "Şubat",
44
- "Mart",
45
- "Nisan",
46
- "Mayıs",
47
- "Haziran",
48
- "Temmuz",
49
- "Ağustos",
50
- "Eylül",
51
- "Ekim",
52
- "Kasım",
53
- "Aralık",
54
- ],
55
- },
56
- firstDayOfWeek: 1,
57
- ordinal: () => {
58
- return ".";
59
- },
60
- rangeSeparator: " - ",
61
- weekAbbreviation: "Hf",
62
- scrollTitle: "Artırmak için kaydırın",
63
- toggleTitle: "Aç/Kapa",
64
- amPM: ["ÖÖ", "ÖS"],
8
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined ? window.flatpickr : {
9
+ l10ns: {}
10
+ };
11
+ var Turkish = {
12
+ weekdays: {
13
+ shorthand: ["Paz", "Pzt", "Sal", "Çar", "Per", "Cum", "Cmt"],
14
+ longhand: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"]
15
+ },
16
+ months: {
17
+ shorthand: ["Oca", "Şub", "Mar", "Nis", "May", "Haz", "Tem", "Ağu", "Eyl", "Eki", "Kas", "Ara"],
18
+ longhand: ["Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"]
19
+ },
20
+ firstDayOfWeek: 1,
21
+ ordinal: function ordinal() {
22
+ return ".";
23
+ },
24
+ rangeSeparator: " - ",
25
+ weekAbbreviation: "Hf",
26
+ scrollTitle: "Artırmak için kaydırın",
27
+ toggleTitle: "Aç/Kapa",
28
+ amPM: ["ÖÖ", "ÖS"]
65
29
  };
66
30
  fp.l10ns.tr = Turkish;
67
31
  var tr = fp.l10ns;
@@ -5,55 +5,19 @@
5
5
  (factory((global.uk = {})));
6
6
  }(this, (function (exports) { 'use strict';
7
7
 
8
- const fp = typeof window !== "undefined" && window.flatpickr !== undefined
9
- ? window.flatpickr
10
- : {
11
- l10ns: {},
12
- };
13
- const Ukrainian = {
14
- firstDayOfWeek: 1,
15
- weekdays: {
16
- shorthand: ["Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"],
17
- longhand: [
18
- "Неділя",
19
- "Понеділок",
20
- "Вівторок",
21
- "Середа",
22
- "Четвер",
23
- "П'ятниця",
24
- "Субота",
25
- ],
26
- },
27
- months: {
28
- shorthand: [
29
- "Січ",
30
- "Лют",
31
- "Бер",
32
- "Кві",
33
- "Тра",
34
- "Чер",
35
- "Лип",
36
- "Сер",
37
- "Вер",
38
- "Жов",
39
- "Лис",
40
- "Гру",
41
- ],
42
- longhand: [
43
- "Січень",
44
- "Лютий",
45
- "Березень",
46
- "Квітень",
47
- "Травень",
48
- "Червень",
49
- "Липень",
50
- "Серпень",
51
- "Вересень",
52
- "Жовтень",
53
- "Листопад",
54
- "Грудень",
55
- ],
56
- },
8
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined ? window.flatpickr : {
9
+ l10ns: {}
10
+ };
11
+ var Ukrainian = {
12
+ firstDayOfWeek: 1,
13
+ weekdays: {
14
+ shorthand: ["Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"],
15
+ longhand: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
16
+ },
17
+ months: {
18
+ shorthand: ["Січ", "Лют", "Бер", "Кві", "Тра", "Чер", "Лип", "Сер", "Вер", "Жов", "Лис", "Гру"],
19
+ longhand: ["Січень", "Лютий", "Березень", "Квітень", "Травень", "Червень", "Липень", "Серпень", "Вересень", "Жовтень", "Листопад", "Грудень"]
20
+ }
57
21
  };
58
22
  fp.l10ns.uk = Ukrainian;
59
23
  var uk = fp.l10ns;
@@ -5,55 +5,19 @@
5
5
  (factory((global.vn = {})));
6
6
  }(this, (function (exports) { 'use strict';
7
7
 
8
- const fp = typeof window !== "undefined" && window.flatpickr !== undefined
9
- ? window.flatpickr
10
- : {
11
- l10ns: {},
12
- };
13
- const Vietnamese = {
14
- weekdays: {
15
- shorthand: ["CN", "T2", "T3", "T4", "T5", "T6", "T7"],
16
- longhand: [
17
- "Chủ nhật",
18
- "Thứ hai",
19
- "Thứ ba",
20
- "Thứ tư",
21
- "Thứ năm",
22
- "Thứ sáu",
23
- "Thứ bảy",
24
- ],
25
- },
26
- months: {
27
- shorthand: [
28
- "Th1",
29
- "Th2",
30
- "Th3",
31
- "Th4",
32
- "Th5",
33
- "Th6",
34
- "Th7",
35
- "Th8",
36
- "Th9",
37
- "Th10",
38
- "Th11",
39
- "Th12",
40
- ],
41
- longhand: [
42
- "Tháng một",
43
- "Tháng hai",
44
- "Tháng ba",
45
- "Tháng tư",
46
- "Tháng năm",
47
- "Tháng sáu",
48
- "Tháng bảy",
49
- "Tháng tám",
50
- "Tháng chín",
51
- "Tháng mười",
52
- "Tháng 11",
53
- "Tháng 12",
54
- ],
55
- },
56
- firstDayOfWeek: 1,
8
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined ? window.flatpickr : {
9
+ l10ns: {}
10
+ };
11
+ var Vietnamese = {
12
+ weekdays: {
13
+ shorthand: ["CN", "T2", "T3", "T4", "T5", "T6", "T7"],
14
+ longhand: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"]
15
+ },
16
+ months: {
17
+ shorthand: ["Th1", "Th2", "Th3", "Th4", "Th5", "Th6", "Th7", "Th8", "Th9", "Th10", "Th11", "Th12"],
18
+ longhand: ["Tháng một", "Tháng hai", "Tháng ba", "Tháng tư", "Tháng năm", "Tháng sáu", "Tháng bảy", "Tháng tám", "Tháng chín", "Tháng mười", "Tháng 11", "Tháng 12"]
19
+ },
20
+ firstDayOfWeek: 1
57
21
  };
58
22
  fp.l10ns.vn = Vietnamese;
59
23
  var vn = fp.l10ns;
@@ -5,58 +5,22 @@
5
5
  (factory((global.zh = {})));
6
6
  }(this, (function (exports) { 'use strict';
7
7
 
8
- const fp = typeof window !== "undefined" && window.flatpickr !== undefined
9
- ? window.flatpickr
10
- : {
11
- l10ns: {},
12
- };
13
- const Mandarin = {
14
- weekdays: {
15
- shorthand: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
16
- longhand: [
17
- "星期日",
18
- "星期一",
19
- "星期二",
20
- "星期三",
21
- "星期四",
22
- "星期五",
23
- "星期六",
24
- ],
25
- },
26
- months: {
27
- shorthand: [
28
- "一月",
29
- "二月",
30
- "三月",
31
- "四月",
32
- "五月",
33
- "六月",
34
- "七月",
35
- "八月",
36
- "九月",
37
- "十月",
38
- "十一月",
39
- "十二月",
40
- ],
41
- longhand: [
42
- "一月",
43
- "二月",
44
- "三月",
45
- "四月",
46
- "五月",
47
- "六月",
48
- "七月",
49
- "八月",
50
- "九月",
51
- "十月",
52
- "十一月",
53
- "十二月",
54
- ],
55
- },
56
- rangeSeparator: " 至 ",
57
- weekAbbreviation: "周",
58
- scrollTitle: "滚动切换",
59
- toggleTitle: "点击切换 12/24 小时时制",
8
+ var fp = typeof window !== "undefined" && window.flatpickr !== undefined ? window.flatpickr : {
9
+ l10ns: {}
10
+ };
11
+ var Mandarin = {
12
+ weekdays: {
13
+ shorthand: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
14
+ longhand: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
15
+ },
16
+ months: {
17
+ shorthand: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
18
+ longhand: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"]
19
+ },
20
+ rangeSeparator: "",
21
+ weekAbbreviation: "",
22
+ scrollTitle: "滚动切换",
23
+ toggleTitle: "点击切换 12/24 小时时制"
60
24
  };
61
25
  fp.l10ns.zh = Mandarin;
62
26
  var zh = fp.l10ns;
@@ -5,43 +5,40 @@
5
5
  (global.confirmDatePlugin = factory());
6
6
  }(this, (function () { 'use strict';
7
7
 
8
- const defaultConfig = {
9
- confirmIcon: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='17' height='17' viewBox='0 0 17 17'> <g> </g> <path d='M15.418 1.774l-8.833 13.485-4.918-4.386 0.666-0.746 4.051 3.614 8.198-12.515 0.836 0.548z' fill='#000000' /> </svg>",
10
- confirmText: "OK ",
11
- showAlways: false,
12
- theme: "light",
8
+ var defaultConfig = {
9
+ confirmIcon: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='17' height='17' viewBox='0 0 17 17'> <g> </g> <path d='M15.418 1.774l-8.833 13.485-4.918-4.386 0.666-0.746 4.051 3.614 8.198-12.515 0.836 0.548z' fill='#000000' /> </svg>",
10
+ confirmText: "OK ",
11
+ showAlways: false,
12
+ theme: "light"
13
13
  };
14
+
14
15
  function confirmDatePlugin(pluginConfig) {
15
- const config = Object.assign({}, defaultConfig, pluginConfig);
16
- let confirmContainer;
17
- return function (fp) {
18
- if (fp.config.noCalendar || fp.isMobile)
19
- return {};
20
- return Object.assign({ onKeyDown(_, __, ___, e) {
21
- if (fp.config.enableTime && e.key === "Tab" && e.target === fp.amPM) {
22
- e.preventDefault();
23
- confirmContainer.focus();
24
- }
25
- else if (e.key === "Enter" && e.target === confirmContainer)
26
- fp.close();
27
- },
28
- onReady() {
29
- confirmContainer = fp._createElement("div", `flatpickr-confirm ${config.showAlways ? "visible" : ""} ${config.theme}Theme`, config.confirmText);
30
- confirmContainer.tabIndex = -1;
31
- confirmContainer.innerHTML += config.confirmIcon;
32
- confirmContainer.addEventListener("click", fp.close);
33
- fp.calendarContainer.appendChild(confirmContainer);
34
- } }, (!config.showAlways
35
- ? {
36
- onChange: function (_, dateStr) {
37
- const showCondition = fp.config.enableTime || fp.config.mode === "multiple";
38
- if (dateStr && !fp.config.inline && showCondition)
39
- return confirmContainer.classList.add("visible");
40
- confirmContainer.classList.remove("visible");
41
- },
42
- }
43
- : {}));
44
- };
16
+ var config = Object.assign({}, defaultConfig, pluginConfig);
17
+ var confirmContainer;
18
+ return function (fp) {
19
+ if (fp.config.noCalendar || fp.isMobile) return {};
20
+ return Object.assign({
21
+ onKeyDown: function onKeyDown(_, __, ___, e) {
22
+ if (fp.config.enableTime && e.key === "Tab" && e.target === fp.amPM) {
23
+ e.preventDefault();
24
+ confirmContainer.focus();
25
+ } else if (e.key === "Enter" && e.target === confirmContainer) fp.close();
26
+ },
27
+ onReady: function onReady() {
28
+ confirmContainer = fp._createElement("div", "flatpickr-confirm " + (config.showAlways ? "visible" : "") + " " + config.theme + "Theme", config.confirmText);
29
+ confirmContainer.tabIndex = -1;
30
+ confirmContainer.innerHTML += config.confirmIcon;
31
+ confirmContainer.addEventListener("click", fp.close);
32
+ fp.calendarContainer.appendChild(confirmContainer);
33
+ }
34
+ }, !config.showAlways ? {
35
+ onChange: function onChange(_, dateStr) {
36
+ var showCondition = fp.config.enableTime || fp.config.mode === "multiple";
37
+ if (dateStr && !fp.config.inline && showCondition) return confirmContainer.classList.add("visible");
38
+ confirmContainer.classList.remove("visible");
39
+ }
40
+ } : {});
41
+ };
45
42
  }
46
43
 
47
44
  return confirmDatePlugin;
@@ -6,24 +6,25 @@
6
6
  }(this, (function () { 'use strict';
7
7
 
8
8
  function labelPlugin() {
9
- return function (fp) {
10
- return {
11
- onReady() {
12
- const id = fp.input.id;
13
- if (!id) {
14
- return;
15
- }
16
- if (fp.mobileInput) {
17
- fp.input.removeAttribute("id");
18
- fp.mobileInput.id = id;
19
- }
20
- else if (fp.altInput) {
21
- fp.input.removeAttribute("id");
22
- fp.altInput.id = id;
23
- }
24
- },
25
- };
9
+ return function (fp) {
10
+ return {
11
+ onReady: function onReady() {
12
+ var id = fp.input.id;
13
+
14
+ if (!id) {
15
+ return;
16
+ }
17
+
18
+ if (fp.mobileInput) {
19
+ fp.input.removeAttribute("id");
20
+ fp.mobileInput.id = id;
21
+ } else if (fp.altInput) {
22
+ fp.input.removeAttribute("id");
23
+ fp.altInput.id = id;
24
+ }
25
+ }
26
26
  };
27
+ };
27
28
  }
28
29
 
29
30
  return labelPlugin;
@@ -5,275 +5,286 @@
5
5
  (global.minMaxTimePlugin = factory());
6
6
  }(this, (function () { 'use strict';
7
7
 
8
- const pad = (number) => `0${number}`.slice(-2);
9
- const int = (bool) => (bool === true ? 1 : 0);
8
+ var pad = function pad(number) {
9
+ return ("0" + number).slice(-2);
10
+ };
11
+ var int = function int(bool) {
12
+ return bool === true ? 1 : 0;
13
+ };
10
14
 
11
- const monthToStr = (monthNumber, shorthand, locale) => locale.months[shorthand ? "shorthand" : "longhand"][monthNumber];
12
- const formats = {
13
- Z: (date) => date.toISOString(),
14
- D: function (date, locale, options) {
15
- return locale.weekdays.shorthand[formats.w(date, locale, options)];
16
- },
17
- F: function (date, locale, options) {
18
- return monthToStr(formats.n(date, locale, options) - 1, false, locale);
19
- },
20
- G: function (date, locale, options) {
21
- return pad(formats.h(date, locale, options));
22
- },
23
- H: (date) => pad(date.getHours()),
24
- J: function (date, locale) {
25
- return locale.ordinal !== undefined
26
- ? date.getDate() + locale.ordinal(date.getDate())
27
- : date.getDate();
28
- },
29
- K: (date, locale) => locale.amPM[int(date.getHours() > 11)],
30
- M: function (date, locale) {
31
- return monthToStr(date.getMonth(), true, locale);
32
- },
33
- S: (date) => pad(date.getSeconds()),
34
- U: (date) => date.getTime() / 1000,
35
- W: function (date, _, options) {
36
- return options.getWeek(date);
37
- },
38
- Y: (date) => date.getFullYear(),
39
- d: (date) => pad(date.getDate()),
40
- h: (date) => (date.getHours() % 12 ? date.getHours() % 12 : 12),
41
- i: (date) => pad(date.getMinutes()),
42
- j: (date) => date.getDate(),
43
- l: function (date, locale) {
44
- return locale.weekdays.longhand[date.getDay()];
45
- },
46
- m: (date) => pad(date.getMonth() + 1),
47
- n: (date) => date.getMonth() + 1,
48
- s: (date) => date.getSeconds(),
49
- w: (date) => date.getDay(),
50
- y: (date) => String(date.getFullYear()).substring(2),
15
+ var monthToStr = function monthToStr(monthNumber, shorthand, locale) {
16
+ return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber];
17
+ };
18
+ var formats = {
19
+ Z: function Z(date) {
20
+ return date.toISOString();
21
+ },
22
+ D: function D(date, locale, options) {
23
+ return locale.weekdays.shorthand[formats.w(date, locale, options)];
24
+ },
25
+ F: function F(date, locale, options) {
26
+ return monthToStr(formats.n(date, locale, options) - 1, false, locale);
27
+ },
28
+ G: function G(date, locale, options) {
29
+ return pad(formats.h(date, locale, options));
30
+ },
31
+ H: function H(date) {
32
+ return pad(date.getHours());
33
+ },
34
+ J: function J(date, locale) {
35
+ return locale.ordinal !== undefined ? date.getDate() + locale.ordinal(date.getDate()) : date.getDate();
36
+ },
37
+ K: function K(date, locale) {
38
+ return locale.amPM[int(date.getHours() > 11)];
39
+ },
40
+ M: function M(date, locale) {
41
+ return monthToStr(date.getMonth(), true, locale);
42
+ },
43
+ S: function S(date) {
44
+ return pad(date.getSeconds());
45
+ },
46
+ U: function U(date) {
47
+ return date.getTime() / 1000;
48
+ },
49
+ W: function W(date, _, options) {
50
+ return options.getWeek(date);
51
+ },
52
+ Y: function Y(date) {
53
+ return date.getFullYear();
54
+ },
55
+ d: function d(date) {
56
+ return pad(date.getDate());
57
+ },
58
+ h: function h(date) {
59
+ return date.getHours() % 12 ? date.getHours() % 12 : 12;
60
+ },
61
+ i: function i(date) {
62
+ return pad(date.getMinutes());
63
+ },
64
+ j: function j(date) {
65
+ return date.getDate();
66
+ },
67
+ l: function l(date, locale) {
68
+ return locale.weekdays.longhand[date.getDay()];
69
+ },
70
+ m: function m(date) {
71
+ return pad(date.getMonth() + 1);
72
+ },
73
+ n: function n(date) {
74
+ return date.getMonth() + 1;
75
+ },
76
+ s: function s(date) {
77
+ return date.getSeconds();
78
+ },
79
+ w: function w(date) {
80
+ return date.getDay();
81
+ },
82
+ y: function y(date) {
83
+ return String(date.getFullYear()).substring(2);
84
+ }
51
85
  };
52
86
 
53
- const defaults = {
54
- _disable: [],
55
- _enable: [],
56
- allowInput: false,
57
- altFormat: "F j, Y",
58
- altInput: false,
59
- altInputClass: "form-control input",
60
- animate: typeof window === "object" &&
61
- window.navigator.userAgent.indexOf("MSIE") === -1,
62
- ariaDateFormat: "F j, Y",
63
- clickOpens: true,
64
- closeOnSelect: true,
65
- conjunction: ", ",
66
- dateFormat: "Y-m-d",
67
- defaultHour: 12,
68
- defaultMinute: 0,
69
- defaultSeconds: 0,
70
- disable: [],
71
- disableMobile: false,
72
- enable: [],
73
- enableSeconds: false,
74
- enableTime: false,
75
- errorHandler: (err) => typeof console !== "undefined" && console.warn(err),
76
- getWeek,
77
- hourIncrement: 1,
78
- ignoredFocusElements: [],
79
- inline: false,
80
- locale: "default",
81
- minuteIncrement: 5,
82
- mode: "single",
83
- 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>",
84
- noCalendar: false,
85
- now: new Date(),
86
- onChange: [],
87
- onClose: [],
88
- onDayCreate: [],
89
- onDestroy: [],
90
- onKeyDown: [],
91
- onMonthChange: [],
92
- onOpen: [],
93
- onParseConfig: [],
94
- onReady: [],
95
- onValueUpdate: [],
96
- onYearChange: [],
97
- onPreCalendarPosition: [],
98
- plugins: [],
99
- position: "auto",
100
- positionElement: undefined,
101
- 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>",
102
- shorthandCurrentMonth: false,
103
- showMonths: 1,
104
- static: false,
105
- time_24hr: false,
106
- weekNumbers: false,
107
- wrap: false,
87
+ var defaults = {
88
+ _disable: [],
89
+ _enable: [],
90
+ allowInput: false,
91
+ altFormat: "F j, Y",
92
+ altInput: false,
93
+ altInputClass: "form-control input",
94
+ animate: typeof window === "object" && window.navigator.userAgent.indexOf("MSIE") === -1,
95
+ ariaDateFormat: "F j, Y",
96
+ clickOpens: true,
97
+ closeOnSelect: true,
98
+ conjunction: ", ",
99
+ dateFormat: "Y-m-d",
100
+ defaultHour: 12,
101
+ defaultMinute: 0,
102
+ defaultSeconds: 0,
103
+ disable: [],
104
+ disableMobile: false,
105
+ enable: [],
106
+ enableSeconds: false,
107
+ enableTime: false,
108
+ errorHandler: function errorHandler(err) {
109
+ return typeof console !== "undefined" && console.warn(err);
110
+ },
111
+ getWeek: getWeek,
112
+ hourIncrement: 1,
113
+ ignoredFocusElements: [],
114
+ inline: false,
115
+ locale: "default",
116
+ minuteIncrement: 5,
117
+ mode: "single",
118
+ 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>",
119
+ noCalendar: false,
120
+ now: new Date(),
121
+ onChange: [],
122
+ onClose: [],
123
+ onDayCreate: [],
124
+ onDestroy: [],
125
+ onKeyDown: [],
126
+ onMonthChange: [],
127
+ onOpen: [],
128
+ onParseConfig: [],
129
+ onReady: [],
130
+ onValueUpdate: [],
131
+ onYearChange: [],
132
+ onPreCalendarPosition: [],
133
+ plugins: [],
134
+ position: "auto",
135
+ positionElement: undefined,
136
+ 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>",
137
+ shorthandCurrentMonth: false,
138
+ showMonths: 1,
139
+ static: false,
140
+ time_24hr: false,
141
+ weekNumbers: false,
142
+ wrap: false
108
143
  };
109
144
 
110
- const english = {
111
- weekdays: {
112
- shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
113
- longhand: [
114
- "Sunday",
115
- "Monday",
116
- "Tuesday",
117
- "Wednesday",
118
- "Thursday",
119
- "Friday",
120
- "Saturday",
121
- ],
122
- },
123
- months: {
124
- shorthand: [
125
- "Jan",
126
- "Feb",
127
- "Mar",
128
- "Apr",
129
- "May",
130
- "Jun",
131
- "Jul",
132
- "Aug",
133
- "Sep",
134
- "Oct",
135
- "Nov",
136
- "Dec",
137
- ],
138
- longhand: [
139
- "January",
140
- "February",
141
- "March",
142
- "April",
143
- "May",
144
- "June",
145
- "July",
146
- "August",
147
- "September",
148
- "October",
149
- "November",
150
- "December",
151
- ],
152
- },
153
- daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
154
- firstDayOfWeek: 0,
155
- ordinal: (nth) => {
156
- const s = nth % 100;
157
- if (s > 3 && s < 21)
158
- return "th";
159
- switch (s % 10) {
160
- case 1:
161
- return "st";
162
- case 2:
163
- return "nd";
164
- case 3:
165
- return "rd";
166
- default:
167
- return "th";
168
- }
169
- },
170
- rangeSeparator: " to ",
171
- weekAbbreviation: "Wk",
172
- scrollTitle: "Scroll to increment",
173
- toggleTitle: "Click to toggle",
174
- amPM: ["AM", "PM"],
175
- yearAriaLabel: "Year",
145
+ var english = {
146
+ weekdays: {
147
+ shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
148
+ longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
149
+ },
150
+ months: {
151
+ shorthand: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
152
+ longhand: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
153
+ },
154
+ daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
155
+ firstDayOfWeek: 0,
156
+ ordinal: function ordinal(nth) {
157
+ var s = nth % 100;
158
+ if (s > 3 && s < 21) return "th";
159
+
160
+ switch (s % 10) {
161
+ case 1:
162
+ return "st";
163
+
164
+ case 2:
165
+ return "nd";
166
+
167
+ case 3:
168
+ return "rd";
169
+
170
+ default:
171
+ return "th";
172
+ }
173
+ },
174
+ rangeSeparator: " to ",
175
+ weekAbbreviation: "Wk",
176
+ scrollTitle: "Scroll to increment",
177
+ toggleTitle: "Click to toggle",
178
+ amPM: ["AM", "PM"],
179
+ yearAriaLabel: "Year"
176
180
  };
177
181
 
178
- const createDateFormatter = ({ config = defaults, l10n = english, }) => (dateObj, frmt, overrideLocale) => {
179
- const locale = overrideLocale || l10n;
182
+ var createDateFormatter = function createDateFormatter(_ref) {
183
+ var _ref$config = _ref.config,
184
+ config = _ref$config === void 0 ? defaults : _ref$config,
185
+ _ref$l10n = _ref.l10n,
186
+ l10n = _ref$l10n === void 0 ? english : _ref$l10n;
187
+ return function (dateObj, frmt, overrideLocale) {
188
+ var locale = overrideLocale || l10n;
189
+
180
190
  if (config.formatDate !== undefined) {
181
- return config.formatDate(dateObj, frmt, locale);
191
+ return config.formatDate(dateObj, frmt, locale);
182
192
  }
183
- return frmt
184
- .split("")
185
- .map((c, i, arr) => formats[c] && arr[i - 1] !== "\\"
186
- ? formats[c](dateObj, locale, config)
187
- : c !== "\\"
188
- ? c
189
- : "")
190
- .join("");
193
+
194
+ return frmt.split("").map(function (c, i, arr) {
195
+ return formats[c] && arr[i - 1] !== "\\" ? formats[c](dateObj, locale, config) : c !== "\\" ? c : "";
196
+ }).join("");
197
+ };
191
198
  };
192
- function compareDates(date1, date2, timeless = true) {
193
- if (timeless !== false) {
194
- return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -
195
- new Date(date2.getTime()).setHours(0, 0, 0, 0));
196
- }
197
- return date1.getTime() - date2.getTime();
199
+ function compareDates(date1, date2, timeless) {
200
+ if (timeless === void 0) {
201
+ timeless = true;
202
+ }
203
+
204
+ if (timeless !== false) {
205
+ return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0);
206
+ }
207
+
208
+ return date1.getTime() - date2.getTime();
198
209
  }
199
210
  function compareTimes(date1, date2) {
200
- return (3600 * (date1.getHours() - date2.getHours()) +
201
- 60 * (date1.getMinutes() - date2.getMinutes()) +
202
- date1.getSeconds() -
203
- date2.getSeconds());
211
+ return 3600 * (date1.getHours() - date2.getHours()) + 60 * (date1.getMinutes() - date2.getMinutes()) + date1.getSeconds() - date2.getSeconds();
204
212
  }
205
- const getWeek = (givenDate) => {
206
- const date = new Date(givenDate.getTime());
207
- date.setHours(0, 0, 0, 0);
208
- date.setDate(date.getDate() + 3 - ((date.getDay() + 6) % 7));
209
- var week1 = new Date(date.getFullYear(), 0, 4);
210
- return (1 +
211
- Math.round(((date.getTime() - week1.getTime()) / 86400000 -
212
- 3 +
213
- ((week1.getDay() + 6) % 7)) /
214
- 7));
213
+ var getWeek = function getWeek(givenDate) {
214
+ var date = new Date(givenDate.getTime());
215
+ date.setHours(0, 0, 0, 0);
216
+ date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
217
+ var week1 = new Date(date.getFullYear(), 0, 4);
218
+ return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);
215
219
  };
216
220
 
217
- function minMaxTimePlugin(config = {}) {
218
- const state = {
219
- formatDate: createDateFormatter({}),
220
- tableDateFormat: config.tableDateFormat || "Y-m-d",
221
- defaults: {
222
- minTime: undefined,
223
- maxTime: undefined,
224
- },
225
- };
226
- function findDateTimeLimit(date) {
227
- if (config.table !== undefined) {
228
- return config.table[state.formatDate(date, state.tableDateFormat)];
229
- }
230
- return config.getTimeLimits && config.getTimeLimits(date);
221
+ function minMaxTimePlugin(config) {
222
+ if (config === void 0) {
223
+ config = {};
224
+ }
225
+
226
+ var state = {
227
+ formatDate: createDateFormatter({}),
228
+ tableDateFormat: config.tableDateFormat || "Y-m-d",
229
+ defaults: {
230
+ minTime: undefined,
231
+ maxTime: undefined
231
232
  }
232
- return function (fp) {
233
- return {
234
- onReady() {
235
- state.formatDate = this.formatDate;
236
- state.defaults = {
237
- minTime: this.config.minTime && state.formatDate(this.config.minTime, "H:i"),
238
- maxTime: this.config.maxTime && state.formatDate(this.config.maxTime, "H:i"),
239
- };
240
- },
241
- onChange() {
242
- const latest = this.latestSelectedDateObj;
243
- const matchingTimeLimit = latest && findDateTimeLimit(latest);
244
- if (latest && matchingTimeLimit !== undefined) {
245
- this.set(matchingTimeLimit);
246
- fp.config.minTime.setFullYear(latest.getFullYear());
247
- fp.config.maxTime.setFullYear(latest.getFullYear());
248
- fp.config.minTime.setMonth(latest.getMonth());
249
- fp.config.maxTime.setMonth(latest.getMonth());
250
- fp.config.minTime.setDate(latest.getDate());
251
- fp.config.maxTime.setDate(latest.getDate());
252
- if (compareDates(latest, fp.config.maxTime, false) > 0) {
253
- fp.setDate(new Date(latest.getTime()).setHours(fp.config.maxTime.getHours(), fp.config.maxTime.getMinutes(), fp.config.maxTime.getSeconds(), fp.config.maxTime.getMilliseconds()), false);
254
- }
255
- else if (compareDates(latest, fp.config.minTime, false) < 0)
256
- fp.setDate(new Date(latest.getTime()).setHours(fp.config.minTime.getHours(), fp.config.minTime.getMinutes(), fp.config.minTime.getSeconds(), fp.config.minTime.getMilliseconds()), false);
257
- }
258
- else {
259
- const newMinMax = state.defaults || {
260
- minTime: undefined,
261
- maxTime: undefined,
262
- };
263
- this.set(newMinMax);
264
- if (!latest)
265
- return;
266
- const { minTime, maxTime } = fp.config;
267
- if (minTime && compareTimes(latest, minTime) < 0) {
268
- fp.setDate(new Date(latest.getTime()).setHours(minTime.getHours(), minTime.getMinutes(), minTime.getSeconds(), minTime.getMilliseconds()), false);
269
- }
270
- else if (maxTime && compareTimes(latest, maxTime) > 0) {
271
- fp.setDate(new Date(latest.getTime()).setHours(maxTime.getHours(), maxTime.getMinutes(), maxTime.getSeconds(), maxTime.getMilliseconds()));
272
- }
273
- }
274
- },
233
+ };
234
+
235
+ function findDateTimeLimit(date) {
236
+ if (config.table !== undefined) {
237
+ return config.table[state.formatDate(date, state.tableDateFormat)];
238
+ }
239
+
240
+ return config.getTimeLimits && config.getTimeLimits(date);
241
+ }
242
+
243
+ return function (fp) {
244
+ return {
245
+ onReady: function onReady() {
246
+ state.formatDate = this.formatDate;
247
+ state.defaults = {
248
+ minTime: this.config.minTime && state.formatDate(this.config.minTime, "H:i"),
249
+ maxTime: this.config.maxTime && state.formatDate(this.config.maxTime, "H:i")
275
250
  };
251
+ },
252
+ onChange: function onChange() {
253
+ var latest = this.latestSelectedDateObj;
254
+ var matchingTimeLimit = latest && findDateTimeLimit(latest);
255
+
256
+ if (latest && matchingTimeLimit !== undefined) {
257
+ this.set(matchingTimeLimit);
258
+ fp.config.minTime.setFullYear(latest.getFullYear());
259
+ fp.config.maxTime.setFullYear(latest.getFullYear());
260
+ fp.config.minTime.setMonth(latest.getMonth());
261
+ fp.config.maxTime.setMonth(latest.getMonth());
262
+ fp.config.minTime.setDate(latest.getDate());
263
+ fp.config.maxTime.setDate(latest.getDate());
264
+
265
+ if (compareDates(latest, fp.config.maxTime, false) > 0) {
266
+ fp.setDate(new Date(latest.getTime()).setHours(fp.config.maxTime.getHours(), fp.config.maxTime.getMinutes(), fp.config.maxTime.getSeconds(), fp.config.maxTime.getMilliseconds()), false);
267
+ } else if (compareDates(latest, fp.config.minTime, false) < 0) fp.setDate(new Date(latest.getTime()).setHours(fp.config.minTime.getHours(), fp.config.minTime.getMinutes(), fp.config.minTime.getSeconds(), fp.config.minTime.getMilliseconds()), false);
268
+ } else {
269
+ var newMinMax = state.defaults || {
270
+ minTime: undefined,
271
+ maxTime: undefined
272
+ };
273
+ this.set(newMinMax);
274
+ if (!latest) return;
275
+ var _fp$config = fp.config,
276
+ minTime = _fp$config.minTime,
277
+ maxTime = _fp$config.maxTime;
278
+
279
+ if (minTime && compareTimes(latest, minTime) < 0) {
280
+ fp.setDate(new Date(latest.getTime()).setHours(minTime.getHours(), minTime.getMinutes(), minTime.getSeconds(), minTime.getMilliseconds()), false);
281
+ } else if (maxTime && compareTimes(latest, maxTime) > 0) {
282
+ fp.setDate(new Date(latest.getTime()).setHours(maxTime.getHours(), maxTime.getMinutes(), maxTime.getSeconds(), maxTime.getMilliseconds()));
283
+ }
284
+ }
285
+ }
276
286
  };
287
+ };
277
288
  }
278
289
 
279
290
  return minMaxTimePlugin;