Implemented phase 6 for the POC prototype in the Website service.

This commit is contained in:
javier committed 2026-09-21 13:53:13 +02:00
1 parent 256d22df40
commit f2f445827b
40 files changed
+1906 -37

No files matched your search

@@ -18,6 +18,29 @@ extension Date {
}
}
/// The days an event runs over, e.g. `Sat 26 – Sun 27 Sep`.
static func span(
from start: Date,
to end: Date
) -> String {
let first = start.formatted(style.weekday(.abbreviated).day())
let last = end.formatted(style.weekday(.abbreviated).day().month(.abbreviated))
return calendar.isDate(start, inSameDayAs: end) ? last : "\(first) – \(last)"
}
/// Whether the date falls within the week from the given moment: an event "this weekend".
func isWithinAWeek(
of now: Date
) -> Bool {
(0..<7 * 86_400).contains(timeIntervalSince(now)) || Self.calendar.isDate(self, inSameDayAs: now)
}
/// The date as a day on a record, e.g. `20 Sep`.
var dayStamp: String {
formatted(Self.style.day().month(.abbreviated))
}
/// The date as a stamp on a record: `today, 09:14`, `yesterday, 21:38`, `20 Sep, 14:05`, or with the year once it differs.
///
/// Read on Amsterdam's clock: the marketplace is NL-first.