Make Memories week span sorting chronological

This commit is contained in:
Cameron
2026-01-26 20:51:11 -05:00
parent a6cc64ece0
commit 7d2a3148bb

View File

@@ -567,13 +567,13 @@ pub async fn list_memories(
match span_mode { match span_mode {
// Sort by absolute time for a more 'overview' // Sort by absolute time for a more 'overview'
MemoriesSpan::Month => memories_with_dates.sort_by(|a, b| a.1.cmp(&b.1)), MemoriesSpan::Month => memories_with_dates.sort_by(|a, b| a.1.cmp(&b.1)),
// For week span, sort by day of month, then by full timestamp (oldest first) // For week span, sort by full date + timestamp (chronological)
MemoriesSpan::Week => { MemoriesSpan::Week => {
memories_with_dates.sort_by(|a, b| { memories_with_dates.sort_by(|a, b| {
// First, sort by day of month // First, sort by full date (year, month, day)
let day_cmp = a.1.day().cmp(&b.1.day()); let date_cmp = a.1.cmp(&b.1);
if day_cmp != std::cmp::Ordering::Equal { if date_cmp != std::cmp::Ordering::Equal {
return day_cmp; return date_cmp;
} }
// Then sort by full created timestamp (oldest to newest) // Then sort by full created timestamp (oldest to newest)