diff --git a/mobile/lib/services/smart_memories_service.dart b/mobile/lib/services/smart_memories_service.dart index ffa42f0eb2..4a00afbdbd 100644 --- a/mobile/lib/services/smart_memories_service.dart +++ b/mobile/lib/services/smart_memories_service.dart @@ -480,6 +480,9 @@ class SmartMemoriesService { final Iterable> locationTagEntities = (await locationService.getLocationTags()); if (allFiles.isEmpty) return []; + final nowInMicroseconds = currentTime.microsecondsSinceEpoch; + final windowEnd = + currentTime.add(kMemoriesUpdateFrequency).microsecondsSinceEpoch; final currentMonth = currentTime.month; final cutOffTime = currentTime.subtract(const Duration(days: 365)); @@ -868,28 +871,12 @@ class SmartMemoriesService { name = "Last year's trip"; } final photoSelection = await _bestSelection(trip.memories); - final firstCreationDate = DateTime.fromMicrosecondsSinceEpoch( - trip.firstCreationTime!, - ); - final firstDateToShow = DateTime( - currentTime.year, - firstCreationDate.month, - firstCreationDate.day, - ).subtract(kMemoriesMargin).microsecondsSinceEpoch; - final lastCreationDate = DateTime.fromMicrosecondsSinceEpoch( - trip.lastCreationTime!, - ); - final lastDateToShow = DateTime( - currentTime.year, - lastCreationDate.month, - lastCreationDate.day, - ).add(kMemoriesMargin).microsecondsSinceEpoch; memoryResults.add( trip.copyWith( memories: photoSelection, title: name, - firstDateToShow: firstDateToShow, - lastDateToShow: lastDateToShow, + firstDateToShow: nowInMicroseconds, + lastDateToShow: windowEnd, ), ); break checkUpcomingMonths;