@10yun/cv-mobile-ui 0.5.43 → 0.5.44

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@10yun/cv-mobile-ui",
3
- "version": "0.5.43",
3
+ "version": "0.5.44",
4
4
  "description": "十云cvjs移动端ui,适用uniapp",
5
5
  "author": "10yun",
6
6
  "license": "Apache-2.0",
@@ -3,7 +3,7 @@
3
3
  </template>
4
4
  <script>
5
5
  export default {
6
- name: 'CcGgIcons',
6
+ name: 'cvSvgs',
7
7
  emits: ['click'],
8
8
  props: {
9
9
  type: {
@@ -1,3 +1,14 @@
1
+ function parseDateSafe(str) {
2
+ if (str instanceof Date) return str;
3
+ if (typeof str !== 'string') return new Date(str);
4
+ // 标准化各种时间格式:
5
+ // - 替换空格为 T
6
+ // - 替换 / 为 -
7
+ const normalized = str.trim().replace(/\//g, '-').replace(' ', 'T');
8
+ const date = new Date(normalized);
9
+ return isNaN(date) ? new Date(str) : date;
10
+ }
11
+
1
12
  /**
2
13
  * 判断某个时间(年/月/日/时分秒)是否完全包含在范围内
3
14
  * @param {string|Date} inputStr
@@ -7,10 +18,11 @@
7
18
  * @returns {boolean}
8
19
  */
9
20
  export function cc_date_time_in_scope(inputStr, startDateStr, endDateStr) {
10
- const startDate = new Date(startDateStr);
11
- const endDate = new Date(endDateStr);
12
- if (isNaN(startDate) || isNaN(endDate)) return false;
13
-
21
+ const startDate = parseDateSafe(startDateStr);
22
+ const endDate = parseDateSafe(endDateStr);
23
+ if (isNaN(startDate) || isNaN(endDate)) {
24
+ return false;
25
+ }
14
26
  let inputStart, inputEnd;
15
27
 
16
28
  if (typeof inputStr === 'string') {
@@ -51,13 +63,15 @@ export function cc_date_time_in_scope(inputStr, startDateStr, endDateStr) {
51
63
  * @param {string|Date} endDateStr - 结束时间
52
64
  * @returns {boolean}
53
65
  */
54
- export function cc_date_time_overlap_scope(inputStr, startDateStr, endDateStr) {
55
- const startDate = new Date(startDateStr);
56
- const endDate = new Date(endDateStr);
66
+
67
+ function cc_date_time_overlap_scope(inputStr, startDateStr, endDateStr) {
68
+ const startDate = parseDateSafe(startDateStr);
69
+ const endDate = parseDateSafe(endDateStr);
57
70
  if (isNaN(startDate) || isNaN(endDate)) {
58
71
  return false;
59
72
  }
60
73
  let inputStart, inputEnd;
74
+
61
75
  if (/^\d{4}$/.test(inputStr)) {
62
76
  // 年份:2025 → 2025-01-01 ~ 2025-12-31 23:59:59
63
77
  inputStart = new Date(`${inputStr}-01-01T00:00:00`);