Use Clock.Now (time-zone aware) instead of raw DateTime.Now for expiry checks
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using NoticeBoard.Data;
|
using NoticeBoard.Data;
|
||||||
|
using NoticeBoard.Infrastructure;
|
||||||
|
|
||||||
namespace NoticeBoard.Controllers;
|
namespace NoticeBoard.Controllers;
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ public class DisplayController : Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Skip expired Meows — expiry is enforced at playback time, not on the stored data
|
// Skip expired Meows — expiry is enforced at playback time, not on the stored data
|
||||||
var now = DateTime.Now;
|
var now = Clock.Now;
|
||||||
device.DeviceSlides = device.DeviceSlides
|
device.DeviceSlides = device.DeviceSlides
|
||||||
.Where(ds => ds.Slide.ExpiresAt == null || ds.Slide.ExpiresAt > now)
|
.Where(ds => ds.Slide.ExpiresAt == null || ds.Slide.ExpiresAt > now)
|
||||||
.ToList();
|
.ToList();
|
||||||
@@ -46,7 +47,7 @@ public class DisplayController : Controller
|
|||||||
|
|
||||||
if (device == null) return NotFound();
|
if (device == null) return NotFound();
|
||||||
|
|
||||||
var now = DateTime.Now;
|
var now = Clock.Now;
|
||||||
var playlist = device.DeviceSlides
|
var playlist = device.DeviceSlides
|
||||||
.Where(ds => ds.Slide.ExpiresAt == null || ds.Slide.ExpiresAt > now)
|
.Where(ds => ds.Slide.ExpiresAt == null || ds.Slide.ExpiresAt > now)
|
||||||
.Select(ds => new
|
.Select(ds => new
|
||||||
|
|||||||
Reference in New Issue
Block a user