From 49f45b6b760d66ad57737762145b32df92b1733b Mon Sep 17 00:00:00 2001 From: Macocian Alexandru Victor Date: Fri, 3 Jul 2026 18:00:59 +0200 Subject: [PATCH] Fix notifications disappearing too soon (Closes #1573) (#1576) --- Daybreak.Core/Services/Notifications/NotificationService.cs | 2 +- Daybreak.Core/Views/Components/NotificationArea.razor | 2 +- Daybreak.Shared/Models/Notifications/Notification.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Daybreak.Core/Services/Notifications/NotificationService.cs b/Daybreak.Core/Services/Notifications/NotificationService.cs index 7b8ac7df..7de43b1b 100644 --- a/Daybreak.Core/Services/Notifications/NotificationService.cs +++ b/Daybreak.Core/Services/Notifications/NotificationService.cs @@ -153,7 +153,7 @@ internal sealed class NotificationService( Title = title, Description = description, Metadata = metaData ?? string.Empty, - ExpirationTime = expirationTime ?? (DateTime.Now + TimeSpan.FromSeconds(5)), + ExpirationTime = expirationTime ?? (DateTime.UtcNow + TimeSpan.FromSeconds(5)), Dismissible = dismissible, Level = logLevel, }; diff --git a/Daybreak.Core/Views/Components/NotificationArea.razor b/Daybreak.Core/Views/Components/NotificationArea.razor index 19fa807c..50aeb2d5 100644 --- a/Daybreak.Core/Views/Components/NotificationArea.razor +++ b/Daybreak.Core/Views/Components/NotificationArea.razor @@ -167,7 +167,7 @@ private void ExtendNotification(NotificationWrapper notification) { - notification.ExpirationTime = DateTime.Now + NotificationExtension; + notification.ExpirationTime = DateTime.UtcNow + NotificationExtension; } private async Task OpenNofitication(NotificationWrapper notification) diff --git a/Daybreak.Shared/Models/Notifications/Notification.cs b/Daybreak.Shared/Models/Notifications/Notification.cs index 53f55054..396074b9 100644 --- a/Daybreak.Shared/Models/Notifications/Notification.cs +++ b/Daybreak.Shared/Models/Notifications/Notification.cs @@ -11,7 +11,7 @@ public class Notification : ICancellableNotification public string Description { get; init; } = string.Empty; public string Metadata { get; init; } = string.Empty; public DateTime ExpirationTime { get; init; } - public DateTime CreationTime { get; init; } = DateTime.Now; + public DateTime CreationTime { get; init; } = DateTime.UtcNow; public bool Dismissible { get; init; } public virtual Type? HandlingType { get; init; }