Extract date rendering into per-feature Date components
This commit is contained in:
1 parent
d95bf0dcbe
commit
455b603299
16 files changed
+168
-71
No files matched your search
@@ -23,8 +23,8 @@ public partial class EventList
|
||||
[CascadingParameter]
|
||||
private HttpContext? HttpContext { get; set; }
|
||||
|
||||
private IReadOnlyList<Event> _upcoming = [];
|
||||
private IReadOnlyList<Event> _past = [];
|
||||
private IReadOnlyList<Event> _upcomingEvents = [];
|
||||
private IReadOnlyList<Event> _pastEvents = [];
|
||||
|
||||
// Set when the content source could not be reached or read. The markup then
|
||||
// shows a "temporarily unavailable" note instead of "no events", matching the
|
||||
@@ -51,13 +51,13 @@ public partial class EventList
|
||||
// Split into upcoming and past by date, so an event earlier today still
|
||||
// counts as upcoming. Upcoming earliest first, past most recent first.
|
||||
var today = DateOnly.FromDateTime(DateTime.Today);
|
||||
_upcoming =
|
||||
_upcomingEvents =
|
||||
[
|
||||
.. events
|
||||
.Where(@event => DateOnly.FromDateTime(@event.Start) >= today)
|
||||
.OrderBy(@event => @event.Start)
|
||||
];
|
||||
_past =
|
||||
_pastEvents =
|
||||
[
|
||||
.. events
|
||||
.Where(@event => DateOnly.FromDateTime(@event.Start) < today)
|
||||
|
||||
Reference in new issue
Block a user