@mptw/skylens-ui 1.4.90 → 1.4.91

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.
@@ -319,19 +319,8 @@ export default defineComponent({
319
319
 
320
320
  return maxDays.value;
321
321
  });
322
- const diffNow = computed(() => {
323
- const now = new Date();
324
- const diffNow = maxDate.value
325
- ? differenceInCalendarDays(now, maxDate.value)
326
- : 0;
327
- return diffNow;
328
- });
329
322
  const baseDate = computed(() => {
330
- if (diffNow.value <= 0) {
331
- return new Date();
332
- }
333
-
334
- return addDays(maxDate.value, 1);
323
+ return maxDate.value || new Date();
335
324
  });
336
325
  const baseDateString = computed(() => {
337
326
  return formatDate(baseDate.value, "yyyy/MM/dd");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mptw/skylens-ui",
3
3
  "type": "module",
4
- "version": "1.4.90",
4
+ "version": "1.4.91",
5
5
  "main": "./nuxt.config.ts",
6
6
  "scripts": {
7
7
  "dev": "nuxi dev .playground",
package/utils/index.ts CHANGED
@@ -32,16 +32,13 @@ export const dateRangeToStatus = (dateRange: IDateRange | null, baseDate = new D
32
32
 
33
33
  const { start, end } = dateRange;
34
34
  const diff = differenceInCalendarDays(end, start);
35
- const isYesterday = differenceInCalendarDays(baseDate, end) === 1;
35
+ const isEndDateEqualBaseDate = differenceInCalendarDays(baseDate, end) === 0;
36
36
 
37
- // if (diff === 0 && isYesterday) {
38
- // return 'yesterday';
39
- // }
40
- if (diff === 6 && isYesterday) {
37
+ if (diff === 6 && isEndDateEqualBaseDate) {
41
38
  return 'last7Days';
42
- } else if (diff === 29 && isYesterday) {
39
+ } else if (diff === 29 && isEndDateEqualBaseDate) {
43
40
  return 'last30Days';
44
- } else if (diff === 89 && isYesterday) {
41
+ } else if (diff === 89 && isEndDateEqualBaseDate) {
45
42
  return 'last90Days';
46
43
  } else if (
47
44
  getYear(start) === getYear(end) &&
@@ -57,20 +54,17 @@ export const dateRangeToStatus = (dateRange: IDateRange | null, baseDate = new D
57
54
  };
58
55
 
59
56
  export const statusToDateRange = (status: string | null, baseDate = new Date()) => {
60
- const yesterday = subDays(baseDate, 1);
61
57
  const lastMonth = subMonths(baseDate, 1);
62
58
 
63
59
  switch (status) {
64
- // case 'yesterday':
65
- // return { start: yesterday, end: yesterday };
66
60
  case 'last30Days':
67
- return { start: subDays(baseDate, 30), end: yesterday };
61
+ return { start: subDays(baseDate, 29), end: baseDate };
68
62
  case 'last90Days':
69
- return { start: subDays(baseDate, 90), end: yesterday };
63
+ return { start: subDays(baseDate, 89), end: baseDate };
70
64
  case 'lastMonth':
71
65
  return { start: startOfMonth(lastMonth), end: endOfMonth(lastMonth) };
72
66
  case 'last7Days':
73
- return { start: subDays(baseDate, 7), end: yesterday };
67
+ return { start: subDays(baseDate, 6), end: baseDate };
74
68
  default:
75
69
  return null;
76
70
  }