662 bug report incorrect timestamps when viewing logs in logs (#672)
* fix: correct timestamp initialization in LogEntry model to use default_factory * fix: update formatDate function to correctly parse and display timestamps in local time
taylor_socfortress committed
Feb 3, 2026 at 13:56 UTC
afa34ce5eb574c5bc1ebdec9a22689551894f4b3
2 files changed
+4
-3
backend/app/db/universal_models.py
+1
-1
@@ -259,7 +259,7 @@ class AgentDataStore(SQLModel, table=True):
259
class LogEntry(SQLModel, table=True):
260
__tablename__ = "log_entries"
261
id: Optional[int] = Field(primary_key=True)
262
- timestamp: datetime = Field(default=datetime.utcnow())
262
+ timestamp: datetime = Field(default_factory=datetime.utcnow)
263
event_type: str = Field(default="Info", max_length=256)
264
user_id: int = Field(default=None, nullable=True)
265
route: str = Field(default=None, nullable=True, max_length=256)
frontend/src/components/logs/LogItem.vue
+3
-2
@@ -91,8 +91,9 @@ const username = computed(() => {
91
return user?.username || ""
92
})
93
94
-function formatDate(timestamp: string | number | Date, utc: boolean = true): string {
95
- return dayjs(timestamp).utc(utc).format(dFormats.datetime)
94
+function formatDate(timestamp: string | number | Date): string {
95
+ // Parse as UTC (since backend stores in UTC without 'Z' suffix - maybe address later), then convert to local
96
+ return dayjs.utc(timestamp).local().format(dFormats.datetime)
97
}
98
</script>
99