@semcore/date-picker 4.56.0 → 16.0.0-prerelease.10

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 (94) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/lib/cjs/DatePicker.js +3 -4
  3. package/lib/cjs/DatePicker.js.map +1 -1
  4. package/lib/cjs/DateRangeComparator.js +2 -2
  5. package/lib/cjs/DateRangeComparator.js.map +1 -1
  6. package/lib/cjs/DateRangePicker.js +2 -2
  7. package/lib/cjs/DateRangePicker.js.map +1 -1
  8. package/lib/cjs/MonthDateRangeComparator.js +2 -2
  9. package/lib/cjs/MonthDateRangeComparator.js.map +1 -1
  10. package/lib/cjs/MonthPicker.js +2 -2
  11. package/lib/cjs/MonthPicker.js.map +1 -1
  12. package/lib/cjs/MonthRangePicker.js +2 -2
  13. package/lib/cjs/MonthRangePicker.js.map +1 -1
  14. package/lib/cjs/components/ButtonTrigger.js +3 -4
  15. package/lib/cjs/components/ButtonTrigger.js.map +1 -1
  16. package/lib/cjs/components/Calendar.js +27 -29
  17. package/lib/cjs/components/Calendar.js.map +1 -1
  18. package/lib/cjs/components/DateRangeComparatorAbstract.js +30 -31
  19. package/lib/cjs/components/DateRangeComparatorAbstract.js.map +1 -1
  20. package/lib/cjs/components/InputTrigger.js +35 -37
  21. package/lib/cjs/components/InputTrigger.js.map +1 -1
  22. package/lib/cjs/components/PickerAbstract.js +30 -31
  23. package/lib/cjs/components/PickerAbstract.js.map +1 -1
  24. package/lib/cjs/components/RangePickerAbstract.js +30 -31
  25. package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
  26. package/lib/cjs/components/index.js +1 -1
  27. package/lib/cjs/components/index.js.map +1 -1
  28. package/lib/cjs/index.d.js.map +1 -1
  29. package/lib/cjs/style/calendar.shadow.css +5 -1
  30. package/lib/es6/DatePicker.js +2 -2
  31. package/lib/es6/DatePicker.js.map +1 -1
  32. package/lib/es6/DateRangeComparator.js +1 -1
  33. package/lib/es6/DateRangeComparator.js.map +1 -1
  34. package/lib/es6/DateRangePicker.js +1 -1
  35. package/lib/es6/DateRangePicker.js.map +1 -1
  36. package/lib/es6/MonthDateRangeComparator.js +1 -1
  37. package/lib/es6/MonthDateRangeComparator.js.map +1 -1
  38. package/lib/es6/MonthPicker.js +1 -1
  39. package/lib/es6/MonthPicker.js.map +1 -1
  40. package/lib/es6/MonthRangePicker.js +1 -1
  41. package/lib/es6/MonthRangePicker.js.map +1 -1
  42. package/lib/es6/components/ButtonTrigger.js +2 -2
  43. package/lib/es6/components/ButtonTrigger.js.map +1 -1
  44. package/lib/es6/components/Calendar.js +25 -25
  45. package/lib/es6/components/Calendar.js.map +1 -1
  46. package/lib/es6/components/DateRangeComparatorAbstract.js +31 -31
  47. package/lib/es6/components/DateRangeComparatorAbstract.js.map +1 -1
  48. package/lib/es6/components/InputTrigger.js +33 -33
  49. package/lib/es6/components/InputTrigger.js.map +1 -1
  50. package/lib/es6/components/PickerAbstract.js +31 -31
  51. package/lib/es6/components/PickerAbstract.js.map +1 -1
  52. package/lib/es6/components/RangePickerAbstract.js +31 -31
  53. package/lib/es6/components/RangePickerAbstract.js.map +1 -1
  54. package/lib/es6/components/index.js +1 -1
  55. package/lib/es6/components/index.js.map +1 -1
  56. package/lib/es6/index.d.js.map +1 -1
  57. package/lib/es6/style/calendar.shadow.css +5 -1
  58. package/lib/esm/DatePicker.mjs +114 -103
  59. package/lib/esm/DateRangeComparator.mjs +166 -149
  60. package/lib/esm/DateRangePicker.mjs +85 -77
  61. package/lib/esm/MonthDateRangeComparator.mjs +187 -169
  62. package/lib/esm/MonthPicker.mjs +78 -71
  63. package/lib/esm/MonthRangePicker.mjs +94 -85
  64. package/lib/esm/components/ButtonTrigger.mjs +16 -15
  65. package/lib/esm/components/Calendar.mjs +404 -286
  66. package/lib/esm/components/DateRangeComparatorAbstract.mjs +453 -329
  67. package/lib/esm/components/InputTrigger.mjs +757 -518
  68. package/lib/esm/components/PickerAbstract.mjs +191 -148
  69. package/lib/esm/components/RangePickerAbstract.mjs +305 -220
  70. package/lib/esm/components/index.mjs +127 -109
  71. package/lib/esm/index.mjs +13 -13
  72. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +32 -32
  73. package/lib/esm/translations/de.json.mjs +83 -56
  74. package/lib/esm/translations/en.json.mjs +95 -64
  75. package/lib/esm/translations/es.json.mjs +83 -56
  76. package/lib/esm/translations/fr.json.mjs +83 -56
  77. package/lib/esm/translations/it.json.mjs +83 -56
  78. package/lib/esm/translations/ja.json.mjs +83 -56
  79. package/lib/esm/translations/ko.json.mjs +83 -56
  80. package/lib/esm/translations/nl.json.mjs +83 -56
  81. package/lib/esm/translations/pl.json.mjs +83 -56
  82. package/lib/esm/translations/pt.json.mjs +83 -56
  83. package/lib/esm/translations/ru.json.mjs +35 -24
  84. package/lib/esm/translations/sv.json.mjs +83 -56
  85. package/lib/esm/translations/tr.json.mjs +83 -56
  86. package/lib/esm/translations/vi.json.mjs +83 -56
  87. package/lib/esm/translations/zh.json.mjs +83 -56
  88. package/lib/esm/utils/cronTabScheduler.mjs +58 -52
  89. package/lib/esm/utils/datesIntersects.mjs +15 -11
  90. package/lib/esm/utils/formatDate.mjs +25 -18
  91. package/lib/esm/utils/includesDate.mjs +13 -9
  92. package/lib/esm/utils/shortDateRangeFormat.mjs +53 -31
  93. package/lib/types/index.d.ts +1 -1
  94. package/package.json +15 -18
@@ -1,62 +1,89 @@
1
- const t = "应用", a = "重置", e = "今天", n = "过去 2 天", s = "上周", o = "上两周", l = "上个月", c = "过去 2 个月", d = "过去 3 个月", h = "过去 6 个月", i = "过去 12 个月", r = "上一个时段", p = "下一时段", M = "日期字段", u = "比较", g = "从 {date}", v = "至 {date}", D = "预设", b = "日期范围", y = "第一个日期范围", R = "第二个日期范围", m = "已开始选择", k = "已选定", E = "请选择可用日期。", W = "请选择可用月份。", f = "请选择一个可用的截止日期。", x = "请选择可用到期月份。", F = {
2
- apply: t,
3
- reset: a,
4
- today: e,
5
- last2Days: n,
6
- lastWeek: s,
7
- last2Weeks: o,
8
- lastMonth: l,
9
- last2Months: c,
10
- last3Months: d,
11
- last6Months: h,
12
- last12Months: i,
13
- prev: r,
14
- next: p,
15
- input: M,
16
- compare: u,
17
- fromDate: g,
18
- toDate: v,
19
- periods: D,
20
- dateRange: b,
21
- dateRange1: y,
22
- dateRange2: R,
23
- selectingStarted: m,
24
- selectingFinished: k,
25
- unavailableDate: E,
26
- unavailableMonth: W,
27
- unavailableEndDate: f,
28
- unavailableEndMonth: x,
1
+ const apply = "应用";
2
+ const reset = "重置";
3
+ const today = "今天";
4
+ const last2Days = "过去 2 天";
5
+ const lastWeek = "上周";
6
+ const last2Weeks = "上两周";
7
+ const lastMonth = "上个月";
8
+ const last2Months = "过去 2 个月";
9
+ const last3Months = "过去 3 个月";
10
+ const last6Months = "过去 6 个月";
11
+ const last12Months = "过去 12 个月";
12
+ const prev = "上一个时段";
13
+ const next = "下一时段";
14
+ const input = "日期字段";
15
+ const compare = "比较";
16
+ const fromDate = "从 {date}";
17
+ const toDate = "至 {date}";
18
+ const periods = "预设";
19
+ const dateRange = "日期范围";
20
+ const dateRange1 = "第一个日期范围";
21
+ const dateRange2 = "第二个日期范围";
22
+ const selectingStarted = "已开始选择";
23
+ const selectingFinished = "已选定";
24
+ const unavailableDate = "请选择可用日期。";
25
+ const unavailableMonth = "请选择可用月份。";
26
+ const unavailableEndDate = "请选择一个可用的截止日期。";
27
+ const unavailableEndMonth = "请选择可用到期月份。";
28
+ const zh = {
29
+ apply,
30
+ reset,
31
+ today,
32
+ last2Days,
33
+ lastWeek,
34
+ last2Weeks,
35
+ lastMonth,
36
+ last2Months,
37
+ last3Months,
38
+ last6Months,
39
+ last12Months,
40
+ prev,
41
+ next,
42
+ input,
43
+ compare,
44
+ fromDate,
45
+ toDate,
46
+ periods,
47
+ dateRange,
48
+ dateRange1,
49
+ dateRange2,
50
+ selectingStarted,
51
+ selectingFinished,
52
+ unavailableDate,
53
+ unavailableMonth,
54
+ unavailableEndDate,
55
+ unavailableEndMonth,
29
56
  "placeholder-days": "日",
30
57
  "placeholder-months": "月",
31
58
  "placeholder-years": "年"
32
59
  };
33
60
  export {
34
- t as apply,
35
- u as compare,
36
- b as dateRange,
37
- y as dateRange1,
38
- R as dateRange2,
39
- F as default,
40
- g as fromDate,
41
- M as input,
42
- i as last12Months,
43
- n as last2Days,
44
- c as last2Months,
45
- o as last2Weeks,
46
- d as last3Months,
47
- h as last6Months,
48
- l as lastMonth,
49
- s as lastWeek,
50
- p as next,
51
- D as periods,
52
- r as prev,
53
- a as reset,
54
- k as selectingFinished,
55
- m as selectingStarted,
56
- v as toDate,
57
- e as today,
58
- E as unavailableDate,
59
- f as unavailableEndDate,
60
- x as unavailableEndMonth,
61
- W as unavailableMonth
61
+ apply,
62
+ compare,
63
+ dateRange,
64
+ dateRange1,
65
+ dateRange2,
66
+ zh as default,
67
+ fromDate,
68
+ input,
69
+ last12Months,
70
+ last2Days,
71
+ last2Months,
72
+ last2Weeks,
73
+ last3Months,
74
+ last6Months,
75
+ lastMonth,
76
+ lastWeek,
77
+ next,
78
+ periods,
79
+ prev,
80
+ reset,
81
+ selectingFinished,
82
+ selectingStarted,
83
+ toDate,
84
+ today,
85
+ unavailableDate,
86
+ unavailableEndDate,
87
+ unavailableEndMonth,
88
+ unavailableMonth
62
89
  };
@@ -1,84 +1,90 @@
1
- import v from "@babel/runtime/helpers/esm/slicedToArray";
2
- function h(i) {
3
- if (i.includes("-")) {
4
- var t = i.split("-"), o = v(t, 2), a = o[0], c = o[1];
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ function cronUnitToArray(unit) {
3
+ if (unit.includes("-")) {
4
+ var _unit$split = unit.split("-"), _unit$split2 = _slicedToArray(_unit$split, 2), start = _unit$split2[0], end = _unit$split2[1];
5
5
  return Array.from({
6
- length: parseInt(c, 10) - parseInt(a, 10) + 1
7
- }, function(s, f) {
8
- return parseInt(a, 10) + f;
6
+ length: parseInt(end, 10) - parseInt(start, 10) + 1
7
+ }, function(_, idx) {
8
+ return parseInt(start, 10) + idx;
9
9
  });
10
10
  }
11
- return i.split(/[,\/]/);
11
+ return unit.split(/[,\/]/);
12
12
  }
13
- function m(i) {
14
- if (typeof i != "string") return !1;
15
- function t(n, e, r) {
16
- var u = h(n), l = /^\d+$|^\*$|^\*\/\d+$/;
17
- return u.every(function(d) {
18
- var y = parseInt(d, 10);
19
- return !(y < e || y > r || !l.test(d));
13
+ function isValidSchedule(pattern) {
14
+ if (typeof pattern !== "string") return false;
15
+ function isValidUnit(unit, min, max) {
16
+ var unitValues = cronUnitToArray(unit);
17
+ var CRON_REG = /^\d+$|^\*$|^\*\/\d+$/;
18
+ return unitValues.every(function(item) {
19
+ var intItem = parseInt(item, 10);
20
+ return !(intItem < min || intItem > max || !CRON_REG.test(item));
20
21
  });
21
22
  }
22
- function o(n) {
23
- return t(n, 1, 12);
23
+ function isValidMonth(month) {
24
+ return isValidUnit(month, 1, 12);
24
25
  }
25
- function a(n) {
26
- return t(n, 1, 7);
26
+ function isValidWeekDay(weekDay) {
27
+ return isValidUnit(weekDay, 1, 7);
27
28
  }
28
- function c(n) {
29
- return t(n, 1, 31);
29
+ function isValidMonthDay(monthDay) {
30
+ return isValidUnit(monthDay, 1, 31);
30
31
  }
31
- function s(n, e, r) {
32
- return e(n) ? !0 : (console.warn("DatePicker disabledSchedule: ".concat(r, " format is invalid")), !1);
32
+ function validate(pattern2, validateFn, msg) {
33
+ if (validateFn(pattern2)) return true;
34
+ console.warn("DatePicker disabledSchedule: ".concat(msg, " format is invalid"));
35
+ return false;
33
36
  }
34
- var f = i.split(" ");
35
- return f.length < 3 ? !1 : f.every(function(n, e) {
36
- switch (e) {
37
+ var patternArr = pattern.split(" ");
38
+ if (patternArr.length < 3) return false;
39
+ return patternArr.every(function(pattern2, idx) {
40
+ switch (idx) {
37
41
  case 0:
38
- return s(n, c, "day of month");
42
+ return validate(pattern2, isValidMonthDay, "day of month");
39
43
  case 1:
40
- return s(n, o, "month");
44
+ return validate(pattern2, isValidMonth, "month");
41
45
  case 2:
42
- return s(n, a, "day of week");
46
+ return validate(pattern2, isValidWeekDay, "day of week");
43
47
  default:
44
- return !1;
48
+ return false;
45
49
  }
46
50
  });
47
51
  }
48
- function p(i, t) {
49
- var o = i.split(" ");
50
- function a(e, r, u) {
51
- return r === "*" ? !0 : e[u]() === parseInt(r, 10);
52
+ function isInPeriod(pattern, date) {
53
+ var patternArr = pattern.split(" ");
54
+ function isInPeriod2(date2, period, dateMethod) {
55
+ if (period === "*") return true;
56
+ return date2[dateMethod]() === parseInt(period, 10);
52
57
  }
53
- function c(e, r) {
54
- return a(e, r, "getMonth");
58
+ function monthInPeriod(date2, period) {
59
+ return isInPeriod2(date2, period, "getMonth");
55
60
  }
56
- function s(e, r) {
57
- return a(e, r, "getDate");
61
+ function monthDayInPeriod(date2, period) {
62
+ return isInPeriod2(date2, period, "getDate");
58
63
  }
59
- function f(e, r) {
60
- return r === 7 && (r = 0), a(e, r, "getDay");
64
+ function weekDayInPeriod(date2, period) {
65
+ if (period === 7) period = 0;
66
+ return isInPeriod2(date2, period, "getDay");
61
67
  }
62
- function n(e, r, u) {
63
- return e.some(function(l) {
64
- return u(r, l);
68
+ function test(units, date2, testFn) {
69
+ return units.some(function(unit) {
70
+ return testFn(date2, unit);
65
71
  });
66
72
  }
67
- return o.every(function(e, r) {
68
- var u = h(e);
69
- switch (r) {
73
+ return patternArr.every(function(unit, idx) {
74
+ var unitValues = cronUnitToArray(unit);
75
+ switch (idx) {
70
76
  case 0:
71
- return n(u, t, s);
77
+ return test(unitValues, date, monthDayInPeriod);
72
78
  case 1:
73
- return n(u, t, c);
79
+ return test(unitValues, date, monthInPeriod);
74
80
  case 2:
75
- return n(u, t, f);
81
+ return test(unitValues, date, weekDayInPeriod);
76
82
  default:
77
- return !1;
83
+ return false;
78
84
  }
79
85
  });
80
86
  }
81
87
  export {
82
- p as isInPeriod,
83
- m as isValidSchedule
88
+ isInPeriod,
89
+ isValidSchedule
84
90
  };
@@ -1,16 +1,20 @@
1
- import A from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { isValidSchedule as T, isInPeriod as w } from "./cronTabScheduler.mjs";
3
- import r from "dayjs";
4
- var f = 864e13, M = function(B, n) {
5
- var m = A(B, 2), e = m[0], t = m[1];
6
- return function(o) {
7
- if (Array.isArray(o)) {
8
- var c = A(o, 2), i = c[0], s = c[1];
9
- return e && r(e).isBetween(i || -f, s || f, n, "[]") || t && r(t).isBetween(i || -f, s || f, n, "[]") || e && t && r(i).isBetween(r(e), r(t), n, "[]") || e && t && r(s).isBetween(r(e), r(t), n, "[]");
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { isValidSchedule, isInPeriod } from "./cronTabScheduler.mjs";
3
+ import dayjs from "dayjs";
4
+ var MAX_DATE_TIMESTAMP = 864e13;
5
+ var datesIntersects = function datesIntersects2(_ref, unit) {
6
+ var _ref2 = _slicedToArray(_ref, 2), dateFrom = _ref2[0], dateTo = _ref2[1];
7
+ return function(disabled_day) {
8
+ if (Array.isArray(disabled_day)) {
9
+ var _disabled_day = _slicedToArray(disabled_day, 2), start = _disabled_day[0], end = _disabled_day[1];
10
+ return dateFrom && dayjs(dateFrom).isBetween(start || -MAX_DATE_TIMESTAMP, end || MAX_DATE_TIMESTAMP, unit, "[]") || dateTo && dayjs(dateTo).isBetween(start || -MAX_DATE_TIMESTAMP, end || MAX_DATE_TIMESTAMP, unit, "[]") || dateFrom && dateTo && dayjs(start).isBetween(dayjs(dateFrom), dayjs(dateTo), unit, "[]") || dateFrom && dateTo && dayjs(end).isBetween(dayjs(dateFrom), dayjs(dateTo), unit, "[]");
10
11
  }
11
- return T(o) ? w(o, e) || w(o, t) : e && t && r(o).isBetween(r(e), r(t), n, "[]");
12
+ if (isValidSchedule(disabled_day)) {
13
+ return isInPeriod(disabled_day, dateFrom) || isInPeriod(disabled_day, dateTo);
14
+ }
15
+ return dateFrom && dateTo && dayjs(disabled_day).isBetween(dayjs(dateFrom), dayjs(dateTo), unit, "[]");
12
16
  };
13
17
  };
14
18
  export {
15
- M as datesIntersects
19
+ datesIntersects
16
20
  };
@@ -1,21 +1,28 @@
1
- import n from "dayjs";
2
- var m = {}, Y = function(t, r) {
3
- m[r] === void 0 && (m[r] = new Intl.DateTimeFormat(r, {
4
- day: "numeric",
5
- month: "short",
6
- year: "numeric"
7
- }));
8
- var a = m[r];
9
- return a.format(n(t).toDate());
10
- }, e = {}, i = function(t, r) {
11
- e[r] === void 0 && (e[r] = new Intl.DateTimeFormat(r, {
12
- month: "long",
13
- year: "numeric"
14
- }));
15
- var a = e[r];
16
- return a.format(n(t).toDate());
1
+ import dayjs from "dayjs";
2
+ var DDMMYYFormattersCache = {};
3
+ var formatDDMMYY = function formatDDMMYY2(date, locale) {
4
+ if (DDMMYYFormattersCache[locale] === void 0) {
5
+ DDMMYYFormattersCache[locale] = new Intl.DateTimeFormat(locale, {
6
+ day: "numeric",
7
+ month: "short",
8
+ year: "numeric"
9
+ });
10
+ }
11
+ var formatter = DDMMYYFormattersCache[locale];
12
+ return formatter.format(dayjs(date).toDate());
13
+ };
14
+ var MMYYYYFormattersCache = {};
15
+ var formatMMYY = function formatMMYY2(date, locale) {
16
+ if (MMYYYYFormattersCache[locale] === void 0) {
17
+ MMYYYYFormattersCache[locale] = new Intl.DateTimeFormat(locale, {
18
+ month: "long",
19
+ year: "numeric"
20
+ });
21
+ }
22
+ var formatter = MMYYYYFormattersCache[locale];
23
+ return formatter.format(dayjs(date).toDate());
17
24
  };
18
25
  export {
19
- Y as formatDDMMYY,
20
- i as formatMMYY
26
+ formatDDMMYY,
27
+ formatMMYY
21
28
  };
@@ -1,14 +1,18 @@
1
- import c from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { isValidSchedule as f, isInPeriod as m } from "./cronTabScheduler.mjs";
3
- var D = function(t, i) {
4
- return function(r) {
5
- if (Array.isArray(r)) {
6
- var e = 864e13, n = c(r, 2), o = n[0], u = n[1];
7
- return t.isBetween(o || -e, u || e, i, "[]");
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import { isValidSchedule, isInPeriod } from "./cronTabScheduler.mjs";
3
+ var includesDate = function includesDate2(date, unit) {
4
+ return function(disabled_day) {
5
+ if (Array.isArray(disabled_day)) {
6
+ var MAX_DATE_TIMESTAMP = 864e13;
7
+ var _disabled_day = _slicedToArray(disabled_day, 2), start = _disabled_day[0], end = _disabled_day[1];
8
+ return date.isBetween(start || -MAX_DATE_TIMESTAMP, end || MAX_DATE_TIMESTAMP, unit, "[]");
8
9
  }
9
- return f(r) ? m(r, t.toDate()) : t.isSame(r, "date");
10
+ if (isValidSchedule(disabled_day)) {
11
+ return isInPeriod(disabled_day, date.toDate());
12
+ }
13
+ return date.isSame(disabled_day, "date");
10
14
  };
11
15
  };
12
16
  export {
13
- D as includesDate
17
+ includesDate
14
18
  };
@@ -1,38 +1,60 @@
1
- import g from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
- import l from "dayjs";
3
- var I = ["locale"], T = ["year"];
4
- function h(o) {
5
- return o.includes("en") || o.includes("ja") ? "en" : "ru";
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ import dayjs from "dayjs";
3
+ var _excluded = ["locale"], _excluded2 = ["year"];
4
+ function getDayJSLocale(locale) {
5
+ if (locale.includes("en") || locale.includes("ja")) {
6
+ return "en";
7
+ }
8
+ return "ru";
6
9
  }
7
- function y(o, f) {
8
- var D = f.locale, e = D === void 0 ? "en-US" : D, a = g(f, I), v = new Intl.DateTimeFormat(e, a), c = v.format, t = o.map(function(r) {
9
- return l(r).toDate();
10
- }), n = o.map(function(r) {
11
- return [l(r).date(), l(r).month(), l(r).year()];
10
+ function shortDateRangeFormat(dates, _ref) {
11
+ var _ref$locale = _ref.locale, locale = _ref$locale === void 0 ? "en-US" : _ref$locale, options = _objectWithoutProperties(_ref, _excluded);
12
+ var _Intl$DateTimeFormat = new Intl.DateTimeFormat(locale, options), format = _Intl$DateTimeFormat.format;
13
+ var normalizeDates = dates.map(function(date) {
14
+ return dayjs(date).toDate();
15
+ });
16
+ var monthsYears = dates.map(function(date) {
17
+ return [dayjs(date).date(), dayjs(date).month(), dayjs(date).year()];
12
18
  });
13
- if (n.length > 1) {
14
- var i = n[0][0] === n[1][0], F = n[0][1] === n[1][1], u = n[0][2] === n[1][2];
15
- if (F && u && !a.day)
16
- return c(t[0]);
17
- if (F && u)
18
- return h(e) === "en" ? i ? "".concat(new Intl.DateTimeFormat(e, {
19
- month: a.month
20
- }).format(t[0]), " ").concat(t[0].getDate(), ", ").concat(t[0].getFullYear()) : "".concat(new Intl.DateTimeFormat(e, {
21
- month: a.month
22
- }).format(t[0]), " ").concat(t[0].getDate(), "-").concat(t[1].getDate(), ", ").concat(t[0].getFullYear()) : i ? "".concat(t[0].getDate(), " ").concat(new Intl.DateTimeFormat(e, {
23
- month: a.month
24
- }).format(t[0]), " ").concat(t[0].getFullYear()) : "".concat(t[0].getDate(), "-").concat(t[1].getDate(), " ").concat(new Intl.DateTimeFormat(e, {
25
- month: a.month
26
- }).format(t[0]), " ").concat(t[0].getFullYear());
27
- if (u) {
28
- a.year;
29
- var m = g(a, T);
30
- return h(e) === "en" ? "".concat(new Intl.DateTimeFormat(e, m).format(t[0]), "-").concat(new Intl.DateTimeFormat(e, m).format(t[1]), ", ").concat(t[0].getFullYear()) : "".concat(new Intl.DateTimeFormat(e, m).format(t[0]), "-").concat(new Intl.DateTimeFormat(e, m).format(t[1]), " ").concat(t[0].getFullYear());
19
+ if (monthsYears.length > 1) {
20
+ var isSimilarDay = monthsYears[0][0] === monthsYears[1][0];
21
+ var isSimilarMonth = monthsYears[0][1] === monthsYears[1][1];
22
+ var isSimilarYear = monthsYears[0][2] === monthsYears[1][2];
23
+ if (isSimilarMonth && isSimilarYear && !options.day) {
24
+ return format(normalizeDates[0]);
25
+ }
26
+ if (isSimilarMonth && isSimilarYear) {
27
+ if (getDayJSLocale(locale) === "en") {
28
+ if (isSimilarDay) {
29
+ return "".concat(new Intl.DateTimeFormat(locale, {
30
+ month: options.month
31
+ }).format(normalizeDates[0]), " ").concat(normalizeDates[0].getDate(), ", ").concat(normalizeDates[0].getFullYear());
32
+ }
33
+ return "".concat(new Intl.DateTimeFormat(locale, {
34
+ month: options.month
35
+ }).format(normalizeDates[0]), " ").concat(normalizeDates[0].getDate(), "-").concat(normalizeDates[1].getDate(), ", ").concat(normalizeDates[0].getFullYear());
36
+ }
37
+ if (isSimilarDay) {
38
+ return "".concat(normalizeDates[0].getDate(), " ").concat(new Intl.DateTimeFormat(locale, {
39
+ month: options.month
40
+ }).format(normalizeDates[0]), " ").concat(normalizeDates[0].getFullYear());
41
+ }
42
+ return "".concat(normalizeDates[0].getDate(), "-").concat(normalizeDates[1].getDate(), " ").concat(new Intl.DateTimeFormat(locale, {
43
+ month: options.month
44
+ }).format(normalizeDates[0]), " ").concat(normalizeDates[0].getFullYear());
45
+ }
46
+ if (isSimilarYear) {
47
+ options.year;
48
+ var newOptions = _objectWithoutProperties(options, _excluded2);
49
+ if (getDayJSLocale(locale) === "en") {
50
+ return "".concat(new Intl.DateTimeFormat(locale, newOptions).format(normalizeDates[0]), "-").concat(new Intl.DateTimeFormat(locale, newOptions).format(normalizeDates[1]), ", ").concat(normalizeDates[0].getFullYear());
51
+ }
52
+ return "".concat(new Intl.DateTimeFormat(locale, newOptions).format(normalizeDates[0]), "-").concat(new Intl.DateTimeFormat(locale, newOptions).format(normalizeDates[1]), " ").concat(normalizeDates[0].getFullYear());
31
53
  }
32
- return "".concat(c(t[0]), "-").concat(c(t[1]));
54
+ return "".concat(format(normalizeDates[0]), "-").concat(format(normalizeDates[1]));
33
55
  }
34
- return c(t[0]);
56
+ return format(normalizeDates[0]);
35
57
  }
36
58
  export {
37
- y as default
59
+ shortDateRangeFormat as default
38
60
  };
@@ -5,7 +5,7 @@ import { UnknownProperties, Intergalactic, PropGetterFn } from '@semcore/core';
5
5
  import Button, { ButtonProps } from '@semcore/button';
6
6
  import Divider from '@semcore/divider';
7
7
  import { DropdownProps, DropdownTriggerProps } from '@semcore/dropdown';
8
- import { WithI18nEnhanceProps } from '@semcore/utils/lib/enhances/i18nEnhance';
8
+ import { WithI18nEnhanceProps } from '@semcore/core/lib/utils/enhances/i18nEnhance';
9
9
  import BaseTrigger, { BaseTriggerProps } from '@semcore/base-trigger';
10
10
  import Input, { InputProps, InputValueProps } from '@semcore/input';
11
11
  import { InputMaskValueProps } from '@semcore/input-mask';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/date-picker",
3
3
  "description": "Semrush DatePicker Component",
4
- "version": "4.56.0",
4
+ "version": "16.0.0-prerelease.10",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,26 +14,23 @@
14
14
  "types": "./lib/types/index.d.ts"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/utils": "4.48.1",
18
- "@semcore/base-trigger": "4.52.1",
19
- "@semcore/button": "5.43.0",
20
- "@semcore/divider": "4.40.1",
21
- "@semcore/dropdown": "4.43.1",
22
- "@semcore/flex-box": "5.41.1",
23
- "@semcore/icon": "4.60.1",
24
- "@semcore/input": "4.42.1",
25
- "@semcore/input-mask": "5.43.1",
26
- "@semcore/neighbor-location": "4.40.1",
27
- "@semcore/typography": "5.52.1",
28
- "@semcore/checkbox": "7.44.1",
29
- "@semcore/popper": "5.46.1",
30
- "@semcore/tooltip": "6.49.1",
17
+ "@semcore/base-trigger": "16.0.0-prerelease.10",
18
+ "@semcore/button": "16.0.0-prerelease.10",
19
+ "@semcore/divider": "16.0.0-prerelease.10",
20
+ "@semcore/popper": "16.0.0-prerelease.10",
21
+ "@semcore/dropdown": "16.0.0-prerelease.10",
22
+ "@semcore/icon": "16.0.0-prerelease.10",
23
+ "@semcore/input": "16.0.0-prerelease.10",
24
+ "@semcore/input-mask": "16.0.0-prerelease.10",
25
+ "@semcore/typography": "16.0.0-prerelease.10",
26
+ "@semcore/checkbox": "16.0.0-prerelease.10",
27
+ "@semcore/tooltip": "16.0.0-prerelease.10",
28
+ "@semcore/flex-box": "16.0.0-prerelease.10",
29
+ "@semcore/neighbor-location": "16.0.0-prerelease.10",
31
30
  "dayjs": "1.8.36"
32
31
  },
33
32
  "peerDependencies": {
34
- "@semcore/core": "^2.17.5",
35
- "react": "16.8 - 18",
36
- "react-dom": "16.8 - 18"
33
+ "@semcore/base-components": "^16.0.0-prerelease.10"
37
34
  },
38
35
  "repository": {
39
36
  "type": "git",