Correctly sort posts during generation

This commit is contained in:
Christoph Hagen
2025-01-29 15:39:26 +01:00
parent 431a953b03
commit a29e6229c1
2 changed files with 8 additions and 1 deletions

View File

@ -13,6 +13,10 @@ protocol DateItem {
extension Sequence where Element: DateItem {
/**
Sort the elements first by their start date (newer first),
and then by id, if the start date is equal.
*/
func sortedByStartDateAndId() -> [Element] {
sorted { (lhs, rhs) -> Bool in
if lhs.startDate == rhs.startDate {