From 07acdcfb8572382fe95474b1d6d2d05d91fbb9b3 Mon Sep 17 00:00:00 2001 From: ethicnology Date: Mon, 20 Jul 2026 10:12:42 -0400 Subject: [PATCH] fix(transactions): preserve UTC when rounding the CSV export end date Building a plain (local) DateTime from a UTC end date's wall-clock fields shifted the inclusive-day boundary by the device's UTC offset, so the same export included or excluded edge transactions depending on the machine's timezone. Round up in UTC when the input is UTC. --- .../usecases/export_transactions_csv_usecase.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/features/transactions/application/usecases/export_transactions_csv_usecase.dart b/lib/features/transactions/application/usecases/export_transactions_csv_usecase.dart index fa16e81cc5..6e11baa44e 100644 --- a/lib/features/transactions/application/usecases/export_transactions_csv_usecase.dart +++ b/lib/features/transactions/application/usecases/export_transactions_csv_usecase.dart @@ -21,8 +21,15 @@ class ExportTransactionsCsvUsecase { final transactions = await _getTransactionsUsecase.execute(); + // Preserve the input's UTC-ness when rounding up to the next day: + // building a plain (local) DateTime from a UTC end's wall-clock fields + // shifted the inclusive-day boundary by the machine's UTC offset, so + // the same export included or excluded edge transactions depending on + // the device's timezone. final exclusiveEnd = end == null ? null + : end.isUtc + ? DateTime.utc(end.year, end.month, end.day + 1) : DateTime(end.year, end.month, end.day + 1); final filtered = transactions.where((tx) {