jufubao-base 1.0.289 → 1.0.290-beta2

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": "jufubao-base",
3
- "version": "1.0.289",
3
+ "version": "1.0.290-beta2",
4
4
  "private": false,
5
5
  "description": "聚福宝业务组件基础插件包",
6
6
  "main": "index.js",
@@ -529,8 +529,20 @@
529
529
  const month = String(date.getMonth() + 1);
530
530
  return `${year}年${month}月`;
531
531
  },
532
+ convertDateFormat(dateStr) {
533
+ if(!dateStr)return''
534
+ // 提取年份和月份
535
+ const year = dateStr.match(/(\d{4})年/)[1];
536
+ const month = dateStr.match(/(\d+)月/)[1];
537
+
538
+ // 确保月份是两位数
539
+ const formattedMonth = month.padStart(2, '0');
540
+
541
+ // 组合成目标格式
542
+ return `${year}-${formattedMonth}-01`;
543
+ },
532
544
  handleLastMonth() {
533
- const dateRange = new Date(this.monthDateRange.replace("年", "-").replace("月", "-01"));
545
+ const dateRange = new Date(this.convertDateFormat(this.monthDateRange));
534
546
  // 获取上一个月的日期范围
535
547
  const previousMonth = new Date(dateRange);
536
548
  previousMonth.setMonth(dateRange.getMonth() - 1);
@@ -540,7 +552,7 @@
540
552
  this.getMonthData()
541
553
  },
542
554
  handleNextMonth() {
543
- const dateRange = new Date(this.monthDateRange.replace("年", "-").replace("月", "-01"));
555
+ const dateRange = new Date(this.convertDateFormat(this.monthDateRange));
544
556
  // 获取下一个月的日期范围
545
557
  const nextMonth = new Date(dateRange);
546
558
  nextMonth.setMonth(dateRange.getMonth() + 1);