فهرست منبع

fix(dashboard): 使用 Day.js 统一日期格式化

将企业小程序首页分配人才卡片中的入职时间格式化从原生 Date.toLocaleDateString() 改为使用 Day.js,与人才管理页面保持一致。

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
yourname 1 هفته پیش
والد
کامیت
07f3cddcdb

+ 1 - 0
mini-ui-packages/yongren-dashboard-ui/package.json

@@ -43,6 +43,7 @@
     "@tarojs/plugin-platform-weapp": "4.1.4",
     "@tarojs/react": "4.1.4",
     "@tarojs/taro": "4.1.4",
+    "dayjs": "^1.11.18",
     "react": "^18.0.0",
     "react-dom": "^18.0.0"
   },

+ 2 - 1
mini-ui-packages/yongren-dashboard-ui/src/pages/Dashboard/Dashboard.tsx

@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react'
 import { View, Text, ScrollView } from '@tarojs/components'
 import Taro from '@tarojs/taro'
 import { useQuery, useQueryClient } from '@tanstack/react-query'
+import dayjs from 'dayjs'
 import { YongrenTabBarLayout } from '@d8d/yongren-shared-ui/components/YongrenTabBarLayout'
 import { Navbar } from '@d8d/mini-shared-ui-components/components/navbar'
 import { enterpriseCompanyClient } from '../../api'
@@ -72,7 +73,7 @@ const Dashboard: React.FC = () => {
     const status = statusMap[talent.workStatus] || '在职'
 
     // 格式化日期
-    const joinDate = talent.joinDate ? new Date(talent.joinDate).toLocaleDateString('zh-CN') : '未知'
+    const joinDate = talent.joinDate ? dayjs(talent.joinDate).format('YYYY-MM-DD') : '未知'
 
     return {
       id: talent.personId?.toString() || '0',

+ 3 - 0
pnpm-lock.yaml

@@ -2423,6 +2423,9 @@ importers:
       '@tarojs/taro':
         specifier: 4.1.4
         version: 4.1.4(@tarojs/components@4.1.4(@tarojs/helper@4.1.4)(@types/react@18.3.26)(html-webpack-plugin@5.6.4(webpack@5.91.0))(postcss@8.5.6)(rollup@3.29.5)(vue@3.5.22(typescript@5.9.3))(webpack-chain@6.5.1)(webpack-dev-server@4.15.2(webpack@5.91.0))(webpack@5.91.0))(@tarojs/helper@4.1.4)(@tarojs/shared@4.1.4)(@types/react@18.3.26)(html-webpack-plugin@5.6.4(webpack@5.91.0))(postcss@8.5.6)(rollup@3.29.5)(vue@3.5.22(typescript@5.9.3))(webpack-chain@6.5.1)(webpack-dev-server@4.15.2(webpack@5.91.0))(webpack@5.91.0)
+      dayjs:
+        specifier: ^1.11.18
+        version: 1.11.18
       react:
         specifier: ^18.0.0
         version: 18.3.1