diff --git a/app/Models/Business/SystemizationTodo.php b/app/Models/Business/SystemizationTodo.php
index c53a1ce8..92ef4109 100644
--- a/app/Models/Business/SystemizationTodo.php
+++ b/app/Models/Business/SystemizationTodo.php
@@ -93,6 +93,20 @@ class SystemizationTodo extends Model
return $this->belongsTo(User::class, 'created_by')->withTrashed();
}
+ public function creationTimeLabel(): string
+ {
+ if ($this->created_at === null) {
+ return '';
+ }
+
+ $timezone = (string) config('app.platform_timezone', config('app.timezone', 'Asia/Shanghai'));
+ if ($timezone === '') {
+ $timezone = 'Asia/Shanghai';
+ }
+
+ return $this->created_at->copy()->setTimezone($timezone)->format('Y-m-d H:i');
+ }
+
public function attachments(): HasMany
{
return $this->hasMany(SystemizationTodoAttachment::class, 'systemization_todo_id')
diff --git a/resources/views/business/pages/systemization-todos.blade.php b/resources/views/business/pages/systemization-todos.blade.php
index 9679939a..d4aa5a88 100644
--- a/resources/views/business/pages/systemization-todos.blade.php
+++ b/resources/views/business/pages/systemization-todos.blade.php
@@ -767,7 +767,7 @@
{{ $item->creator?->name ?: '—' }} |
- {{ $item->created_at?->format('Y-m-d H:i') ?: '—' }} |
+ {{ $item->creationTimeLabel() ?: '—' }} |
@php($ownerNames = $personNames($item->owner_display ?? null))
created_by;
$createdAt = $todo->created_at->format('Y-m-d H:i:s');
- $displayedCreatedAt = $todo->created_at->format('Y-m-d H:i');
+ $displayedCreatedAt = $todo->creationTimeLabel();
$this->get(route('business.pages.show', [
'section' => 'other',
@@ -1402,6 +1402,43 @@ class SystemizationTodosTest extends FeatureTestCase
}
}
+ public function test_creation_time_is_displayed_in_the_platform_timezone(): void
+ {
+ $originalTimezone = config('app.timezone');
+ $originalPlatformTimezone = config('app.platform_timezone');
+
+ try {
+ config([
+ 'app.timezone' => 'Europe/London',
+ 'app.platform_timezone' => 'Asia/Shanghai',
+ ]);
+ date_default_timezone_set('Europe/London');
+ Carbon::setTestNow('2026-11-10 08:21:30');
+
+ $this->loginAs();
+ $todo = $this->createTodo('收入', '创建时间测试', '创建时间按上海展示', '2026-11-12', 1);
+ $todo->refresh();
+
+ $this->assertSame('2026-11-10 08:21', $todo->created_at->format('Y-m-d H:i'));
+ $this->assertSame('2026-11-10 16:21', $todo->creationTimeLabel());
+
+ $this->get(route('business.pages.show', [
+ 'section' => 'other',
+ 'page' => 'systemization-todos',
+ ]))->assertOk()->assertSee(
+ 'data-sys-todo-immutable="created_at">2026-11-10 16:21 | ',
+ false,
+ );
+ } finally {
+ Carbon::setTestNow();
+ config([
+ 'app.timezone' => $originalTimezone,
+ 'app.platform_timezone' => $originalPlatformTimezone,
+ ]);
+ date_default_timezone_set((string) $originalTimezone);
+ }
+ }
+
public function test_edit_redirect_keeps_current_filters_and_highlight(): void
{
$this->loginAs();