[PR #468] [MERGED] Fix default timestamp for activity logs #778

Closed
opened 2026-02-05 17:54:09 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/pelican-dev/panel/pull/468
Author: @Boy132
Created: 7/8/2024
Status: Merged
Merged: 7/10/2024
Merged by: @Boy132

Base: mainHead: fix/activity-log-timestamp-timezone


📝 Commits (2)

📊 Changes

2 files changed (+32 additions, -0 deletions)

View changed files

📝 app/Models/ActivityLog.php (+4 -0)
database/migrations/2024_07_08_112948_fix-activity-log-timestamp-default.php (+28 -0)

📄 Description

The timestamp column for activity logs uses useCurrent which sets the default column value to CURRENT_TIMESTAMP. But this uses the database timezone.
This causes the timezone to be "added twice" on the frontend.

Example with Europe/Berlin:
grafik
grafik

This PR removes the default and sets the timestamp to Carbon::now() when the model is created.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/pelican-dev/panel/pull/468 **Author:** [@Boy132](https://github.com/Boy132) **Created:** 7/8/2024 **Status:** ✅ Merged **Merged:** 7/10/2024 **Merged by:** [@Boy132](https://github.com/Boy132) **Base:** `main` ← **Head:** `fix/activity-log-timestamp-timezone` --- ### 📝 Commits (2) - [`4be948a`](https://github.com/pelican-dev/panel/commit/4be948af07c3e46754e5d8ffea7c4d5acfffbbb2) fix default timestamp for activity logs - [`97aec8a`](https://github.com/pelican-dev/panel/commit/97aec8a8735a3213e4201a5d0df4b4657015b428) fix phpstan ### 📊 Changes **2 files changed** (+32 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `app/Models/ActivityLog.php` (+4 -0) ➕ `database/migrations/2024_07_08_112948_fix-activity-log-timestamp-default.php` (+28 -0) </details> ### 📄 Description The `timestamp` column for activity logs [uses `useCurrent`](https://github.com/pelican-dev/panel/blob/main/database/migrations/2022_05_28_135717_create_activity_logs_table.php#L22) which sets the default column value to `CURRENT_TIMESTAMP`. But this uses the database timezone. This causes the timezone to be "added twice" on the frontend. Example with `Europe/Berlin`: ![grafik](https://github.com/pelican-dev/panel/assets/8203120/d3fc5999-647a-4358-a86a-a1e1d71bdd0a) ![grafik](https://github.com/pelican-dev/panel/assets/8203120/11488441-398a-4076-99f2-34e26910f7a7) This PR removes the default and sets the timestamp to `Carbon::now()` when the model is created. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 17:54:09 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/panel-pelican-dev#778