amos-apptool 1.2.0 → 1.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.
@@ -23,8 +23,8 @@ const DateHelper = {
23
23
  const n = new Date(Number(e), parseInt(t) - 1, Number(a));
24
24
  let D = n.getDay();
25
25
  const o = n.getDate();
26
- let g = 6 - D;
27
- return 0 !== r && (D = 0 === D ? 7 : D, g = 7 - D), Math.ceil((o + g) / 7);
26
+ let y = 6 - D;
27
+ return 0 !== r && (D = 0 === D ? 7 : D, y = 7 - D), Math.ceil((o + y) / 7);
28
28
  },
29
29
  getYearWeek(e, t, a, r = 0) {
30
30
  const n = new Date(Number(e), parseInt(t) - 1, Number(a)), D = new Date(Number(e), 0, 1), o = Math.round((n.valueOf() - D.valueOf()) / 864e5);
@@ -38,8 +38,8 @@ const DateHelper = {
38
38
  return [ DateHelper.date2Str(new Date(t)), DateHelper.date2Str(new Date(a)) ];
39
39
  }
40
40
  o = 0 === o ? 7 : o;
41
- const g = 864e5, l = D - (o - 1) * g, y = D + (7 - o) * g;
42
- return [ DateHelper.date2Str(new Date(l)), DateHelper.date2Str(new Date(y)) ];
41
+ const y = 864e5, g = D - (o - 1) * y, s = D + (7 - o) * y;
42
+ return [ DateHelper.date2Str(new Date(g)), DateHelper.date2Str(new Date(s)) ];
43
43
  },
44
44
  formatResultDate(e) {
45
45
  const t = [ ...e.split("-") ];
@@ -69,13 +69,13 @@ const DateHelper = {
69
69
  n <= 0 && (n = 12, D += 1);
70
70
  let o = DateHelper.getMonthPreDay(+t, +a);
71
71
  o -= r, "prev" === e && o >= 7 && (o -= 7);
72
- const g = DateHelper.getMonthDays(`${D}`, `${n}`);
73
- return Array.from(Array(g), (t, a) => ({
72
+ const y = DateHelper.getMonthDays(`${D}`, `${n}`);
73
+ return Array.from(Array(y), (t, a) => ({
74
74
  day: a + 1,
75
75
  type: e,
76
76
  year: D,
77
77
  month: n
78
- })).slice(g - o);
78
+ })).slice(y - o);
79
79
  }, convertDateToDay = e => e ? {
80
80
  year: e.getFullYear(),
81
81
  month: e.getMonth() + 1,
@@ -103,7 +103,19 @@ const DateHelper = {
103
103
  }, getCurrentWeekDays = (e, t) => {
104
104
  const a = new Date(e.year, e.month - 1, e.date), r = (a.getDay() + 7 - t) % 7;
105
105
  return [ convertDateToDay(new Date(a.getTime() - 864e5 * r)), convertDateToDay(new Date(a.getTime() + 864e5 * (6 - r))) ];
106
- }, CalendarUtils = {
106
+ };
107
+
108
+ function checkIsToday(e) {
109
+ if ("object" != typeof e) return !1;
110
+ const {type: t, year: a, month: r, date: n} = e || {};
111
+ if ("current" === t) {
112
+ const e = new Date, t = convertDateToDay(e);
113
+ return a === t.year && r === t.month && n === t.date;
114
+ }
115
+ return !1;
116
+ }
117
+
118
+ const CalendarUtils = {
107
119
  DateHelper: DateHelper,
108
120
  getCurrMonthData: getCurrMonthData,
109
121
  getDaysStatus: getDaysStatus,
@@ -112,7 +124,8 @@ const DateHelper = {
112
124
  convertDayToDate: convertDayToDate,
113
125
  getPrevMonthDays: getPrevMonthDays,
114
126
  getCurrentMonthDays: getCurrentMonthDays,
115
- getCurrentWeekDays: getCurrentWeekDays
127
+ getCurrentWeekDays: getCurrentWeekDays,
128
+ checkIsToday: checkIsToday
116
129
  };
117
130
 
118
131
  export { CalendarUtils };