Commit: 99f1497
Parent: eb449e4

Put notifications in timezone

Mårten Åsberg committed on 2026-05-28 at 06:55
MatDenDagen/Services/NotificationService.cs +2 -1
diff --git a/MatDenDagen/Services/NotificationService.cs b/MatDenDagen/Services/NotificationService.cs
index aa38ea6..9c6edba 100644
@@ -21,6 +21,7 @@ public sealed class NotificationService(
)
{
private readonly TimeSpan interval = options.Value.CheckInterval;
private readonly TimeSpan timeZoneOffset = options.Value.TimeZoneOffset;
public async Task<DateTimeOffset> CheckAndSendNotificationsAsync(
DateTimeOffset? lastCheck,
@@ -39,7 +40,7 @@ public sealed class NotificationService(
return utcNow;
}
var eventDate = new DateTimeOffset(theDay.ToDateTime(TimeOnly.MinValue, DateTimeKind.Utc), TimeSpan.Zero);
var eventDate = new DateTimeOffset(theDay.ToDateTime(TimeOnly.MinValue, DateTimeKind.Local), timeZoneOffset);
var participants = await questionnaireContext
.Participants.AsNoTracking()
MatDenDagen/Services/NotificationServiceExtensions.cs +2 -0
diff --git a/MatDenDagen/Services/NotificationServiceExtensions.cs b/MatDenDagen/Services/NotificationServiceExtensions.cs
index 7daceb9..0e2b08c 100644
@@ -19,4 +19,6 @@ public static class NotificationServiceExtensions
public sealed class NotificationServiceOptions
{
public TimeSpan CheckInterval { get; set; } = TimeSpan.FromMinutes(5);
public TimeSpan TimeZoneOffset { get; set; } = TimeSpan.FromHours(2);
}