fix(timezone): use UTC for database storage and local time for UI display

Backend changes:
- SQL Server dialect: GETDATE() → SYSUTCDATETIME()
- MySQL dialect: NOW() → UTC_TIMESTAMP()
- Ensures OperationTime and EndTime use consistent UTC timezone

Frontend changes:
- formatDateTime: display UTC timestamps in user's local timezone
- Uses getFullYear/getMonth/getDate/getHours (local) instead of UTC methods

Data migration:
- Executed migration script to fix historical OperationTime records
- All existing records now have correct UTC timestamps
- Execution duration now accurate (minutes, not hours)

Impact:
- New executions store UTC timestamps correctly
- UI displays times in user's local timezone (UTC+8 for CN users)
- Historical data corrected via migration
- Time difference between OperationTime and EndTime now accurate
This commit is contained in:
Misaka_Company
2026-04-13 17:52:50 +08:00
parent 6aa1fc29e5
commit 420f811488
3 changed files with 9 additions and 8 deletions

View File

@@ -27,7 +27,7 @@ export class MySqlDialect implements SqlDialect {
}
currentTimestamp(): string {
return 'NOW()'
return 'UTC_TIMESTAMP()'
}
upsert(params: {

View File

@@ -26,7 +26,7 @@ export class SqlServerDialect implements SqlDialect {
}
currentTimestamp(): string {
return 'GETDATE()'
return 'SYSUTCDATETIME()'
}
upsert(params: {