Normalize all DateTime values to UTC across the codebase
Npgsql requires DateTimeKind.Utc for timestamp with time zone columns. This fixes errors in transaction create/edit, budgets, reports, loans, scheduled transactions, and file imports. Changes: - TransactionService: SpecifyKind on request.Date for create, update, and transfer - BudgetService: UTC kind on all new DateTime(year, month, 1) - ReportService: UTC kind on endOfMonth; rewrite spending-by- category GroupBy to avoid untranslatable navigation properties - LoanService: UTC kind on payoff scenario date construction - ScheduledTransactionService: UTC kind on SemiMonthly date - ImportService: SpecifyKind on parsed.Date when persisting - OFX/CSV/QIF parsers: AssumeUniversal + AdjustToUniversal on all date parsing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -47,7 +47,7 @@ public class QIFParserPlugin : IFileParser
|
||||
case 'D':
|
||||
current ??= new ParsedTransaction();
|
||||
if (DateTime.TryParse(value, System.Globalization.CultureInfo.InvariantCulture,
|
||||
System.Globalization.DateTimeStyles.None, out var date))
|
||||
System.Globalization.DateTimeStyles.AssumeUniversal | System.Globalization.DateTimeStyles.AdjustToUniversal, out var date))
|
||||
current.Date = date;
|
||||
else if (TryParseQIFDate(value, out var qifDate))
|
||||
current.Date = qifDate;
|
||||
@@ -105,6 +105,6 @@ public class QIFParserPlugin : IFileParser
|
||||
|
||||
return DateTime.TryParseExact(cleaned, formats,
|
||||
System.Globalization.CultureInfo.InvariantCulture,
|
||||
System.Globalization.DateTimeStyles.None, out date);
|
||||
System.Globalization.DateTimeStyles.AssumeUniversal | System.Globalization.DateTimeStyles.AdjustToUniversal, out date);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user