fix(mining-app): 修复记录页面时间显示为UTC而非北京时间的问题

所有记录页面的 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 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-03-02 06:12:16 -08:00
parent 6e3a898801
commit 5fad40cec1
5 changed files with 10 additions and 10 deletions

View File

@ -327,7 +327,7 @@ class _ContributionRecordsListPageState extends ConsumerState<ContributionRecord
Icon(Icons.calendar_today_outlined, size: 12, color: _grayText.withOpacity(0.7)),
const SizedBox(width: 4),
Text(
'生效: ${DateFormat('yyyy-MM-dd').format(record.effectiveDate)}',
'生效: ${DateFormat('yyyy-MM-dd').format(record.effectiveDate.toLocal())}',
style: TextStyle(fontSize: 11, color: _grayText.withOpacity(0.7)),
),
],
@ -342,7 +342,7 @@ class _ContributionRecordsListPageState extends ConsumerState<ContributionRecord
),
const SizedBox(width: 4),
Text(
'过期: ${DateFormat('yyyy-MM-dd').format(record.expireDate)}',
'过期: ${DateFormat('yyyy-MM-dd').format(record.expireDate.toLocal())}',
style: TextStyle(
fontSize: 11,
color: record.isExpired ? Colors.red.withOpacity(0.7) : _grayText.withOpacity(0.7),

View File

@ -305,7 +305,7 @@ class _BatchMiningRecordsListPageState extends ConsumerState<BatchMiningRecordsL
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)),
),
],

View File

@ -256,7 +256,7 @@ class _MiningRecordsListPageState extends ConsumerState<MiningRecordsListPage> {
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)),
),
],

View File

@ -268,13 +268,13 @@ class _PlantingRecordsPageState extends ConsumerState<PlantingRecordsPage> {
_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<PlantingRecordsPage> {
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)),
),
],

View File

@ -341,7 +341,7 @@ class _TradingRecordsPageState extends ConsumerState<TradingRecordsPage> 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<TradingRecordsPage> 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),
),
],