Skip to content

Commit f6481e8

Browse files
committed
Fix Workout.StartDate filter: Workout has no DateRange, use StartDate (Instant)
Both Record.StartDate and Workout.StartDate are NodaTime.Instant — confirmed from HealthKitData source. Previous fix incorrectly used w.DateRange.Start (DateRange property doesn't exist on Workout). https://claude.ai/code/session_01GwHuC47PH81Zw3EUfgkrYN
1 parent 641323f commit f6481e8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/HealthNerd.Wasm/Pages/Home.razor

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,12 +270,10 @@
270270
"Make sure you upload the export.zip produced by the Health app.");
271271

272272
// Filter records by since-date.
273-
// Record.StartDate : NodaTime.Instant
274-
// Workout.DateRange : NodaTime.DateInterval (DateRange.Start is LocalDate)
275-
var sinceInstant = Instant.FromDateTimeUtc(DateTime.SpecifyKind(ws.SinceDate, DateTimeKind.Utc));
276-
var sinceLocalDate = LocalDate.FromDateTime(ws.SinceDate);
277-
var records = loader.Records .Where(r => r.StartDate >= sinceInstant).ToList();
278-
var workouts = loader.Workouts.Where(w => w.DateRange.Start >= sinceLocalDate).ToList();
273+
// Both Record.StartDate and Workout.StartDate are NodaTime.Instant.
274+
var sinceInstant = Instant.FromDateTimeUtc(DateTime.SpecifyKind(ws.SinceDate, DateTimeKind.Utc));
275+
var records = loader.Records .Where(r => r.StartDate >= sinceInstant).ToList();
276+
var workouts = loader.Workouts.Where(w => w.StartDate >= sinceInstant).ToList();
279277

280278
// Load custom sheets (sheets whose names begin with "custom")
281279
ExcelPackage? customPackage = null;

0 commit comments

Comments
 (0)