From 5fad40cec11126f4d98cafd731d6396dea349eb7 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 2 Mar 2026 06:12:16 -0800 Subject: [PATCH] =?UTF-8?q?fix(mining-app):=20=E4=BF=AE=E5=A4=8D=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E9=9D=A2=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E4=B8=BAUTC=E8=80=8C=E9=9D=9E=E5=8C=97=E4=BA=AC=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 所有记录页面的 DateFormat().format() 缺少 .toLocal() 调用, 导致后端返回的 UTC 时间直接显示,与北京时间相差8小时。 修复范围(5个页面,10处): - mining_records_page: record.createdAt - batch_mining_records_page: record.createdAt - contribution_records_page: record.effectiveDate, record.expireDate - planting_records_page: summary.firstPlantingAt, summary.lastPlantingAt, record.adoptionDate, record.createdAt - trading_records_page: order.createdAt, trade.createdAt Co-Authored-By: Claude Opus 4.6 --- .../pages/contribution/contribution_records_page.dart | 4 ++-- .../pages/profile/batch_mining_records_page.dart | 2 +- .../presentation/pages/profile/mining_records_page.dart | 2 +- .../presentation/pages/profile/planting_records_page.dart | 8 ++++---- .../presentation/pages/profile/trading_records_page.dart | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/mining-app/lib/presentation/pages/contribution/contribution_records_page.dart b/frontend/mining-app/lib/presentation/pages/contribution/contribution_records_page.dart index 051a0ea2..acffda7b 100644 --- a/frontend/mining-app/lib/presentation/pages/contribution/contribution_records_page.dart +++ b/frontend/mining-app/lib/presentation/pages/contribution/contribution_records_page.dart @@ -327,7 +327,7 @@ class _ContributionRecordsListPageState extends ConsumerState { Icon(Icons.access_time, size: 12, color: _grayText.withOpacity(0.7)), const SizedBox(width: 4), Text( - DateFormat('yyyy-MM-dd HH:mm:ss').format(record.createdAt), + DateFormat('yyyy-MM-dd HH:mm:ss').format(record.createdAt.toLocal()), style: TextStyle(fontSize: 11, color: _grayText.withOpacity(0.7)), ), ], diff --git a/frontend/mining-app/lib/presentation/pages/profile/planting_records_page.dart b/frontend/mining-app/lib/presentation/pages/profile/planting_records_page.dart index 5fd57f17..0cf4444c 100644 --- a/frontend/mining-app/lib/presentation/pages/profile/planting_records_page.dart +++ b/frontend/mining-app/lib/presentation/pages/profile/planting_records_page.dart @@ -268,13 +268,13 @@ class _PlantingRecordsPageState extends ConsumerState { _buildSummaryItem( '首次参与', summary.firstPlantingAt != null - ? DateFormat('MM-dd').format(summary.firstPlantingAt!) + ? DateFormat('MM-dd').format(summary.firstPlantingAt!.toLocal()) : '-', ), _buildSummaryItem( '最近参与', summary.lastPlantingAt != null - ? DateFormat('MM-dd').format(summary.lastPlantingAt!) + ? DateFormat('MM-dd').format(summary.lastPlantingAt!.toLocal()) : '-', ), ], @@ -360,8 +360,8 @@ class _PlantingRecordsPageState extends ConsumerState { const SizedBox(width: 4), Text( record.adoptionDate != null - ? DateFormat('yyyy-MM-dd HH:mm').format(record.adoptionDate!) - : DateFormat('yyyy-MM-dd HH:mm').format(record.createdAt), + ? DateFormat('yyyy-MM-dd HH:mm').format(record.adoptionDate!.toLocal()) + : DateFormat('yyyy-MM-dd HH:mm').format(record.createdAt.toLocal()), style: TextStyle(fontSize: 11, color: _grayText.withOpacity(0.7)), ), ], diff --git a/frontend/mining-app/lib/presentation/pages/profile/trading_records_page.dart b/frontend/mining-app/lib/presentation/pages/profile/trading_records_page.dart index d3f0bcdf..284371e7 100644 --- a/frontend/mining-app/lib/presentation/pages/profile/trading_records_page.dart +++ b/frontend/mining-app/lib/presentation/pages/profile/trading_records_page.dart @@ -341,7 +341,7 @@ class _TradingRecordsPageState extends ConsumerState with Si Icon(Icons.access_time, size: 11, color: _lightGray), const SizedBox(width: 4), Text( - DateFormat('MM-dd HH:mm').format(order.createdAt), + DateFormat('MM-dd HH:mm').format(order.createdAt.toLocal()), style: TextStyle(fontSize: 11, color: _lightGray), ), ], @@ -384,7 +384,7 @@ class _TradingRecordsPageState extends ConsumerState with Si ), ), Text( - DateFormat('MM-dd HH:mm').format(trade.createdAt), + DateFormat('MM-dd HH:mm').format(trade.createdAt.toLocal()), style: TextStyle(fontSize: 12, color: _lightGray), ), ],