Fix: Apply DateTimeFormats and Culture from CsvReaderOptions to DateTimeConverter#44
Conversation
…imeConverter Addresses issue #43 where Import-DbaCsv ignores -DateTimeFormats and -Culture parameters. The issue was in CsvDataReader.CacheColumnConverters() which always used the default DateTimeConverter instance from the registry, which has no custom formats and uses InvariantCulture. Now when DateTimeFormats or Culture are specified in CsvReaderOptions, a custom DateTimeConverter is created with those settings. This ensures dates like '04/02/2026 15:14:21' with format 'dd/MM/yyyy HH:mm:ss' are parsed correctly as February 4th instead of April 2nd. Changes: - Modified CsvDataReader.CacheColumnConverters() to create custom DateTimeConverter instances when DateTimeFormats or Culture are specified in options - Added test TestDateTimeConversionWithCustomFormats() to verify dd/MM/yyyy parsing - Added test TestDateTimeConversionWithCulture() to verify Culture parameter support Co-authored-by: Chrissy LeMaire <[email protected]>
|
@claude can you create tests in this branch? |
|
Claude finished @potatoqualitee's task in 2m 7s —— View job Creating Additional Tests - Complete ✓
SummarySuccessfully added 10 comprehensive DateTime conversion tests to New Tests:
These tests cover edge cases like:
Changes pushed to branch:
The tests follow the existing test patterns and should work seamlessly with the fix implemented in | Branch |
Code Review - PR #44SummaryThis PR successfully addresses issue #43 by fixing the CSV reader to properly respect the ✅ Strengths
🔍 Code Quality ObservationsCsvDataReader.cs (Lines 496-527)Positive:
Minor Observations:
CsvDataReaderTest.cs (Lines 343-399)Positive:
Suggestions:
🔒 Security ConsiderationsNo security issues identified. The changes:
⚡ Performance ConsiderationsImpact: Minimal positive/neutral
🧪 Testing RecommendationsCurrent coverage is good, but consider adding:
📋 Suggested Improvements (Optional)These are minor enhancements, not blockers:
✅ Final VerdictAPPROVED - This PR is ready to merge. The implementation correctly fixes the reported issue with minimal, focused changes. The test coverage adequately validates the fix. The code quality is good and consistent with the existing codebase. Recommendation: Merge after addressing any of the optional suggestions you find valuable. 📚 References
|
Added 10 new tests to thoroughly cover DateTimeFormats and Culture parameter handling: - Multiple date format precedence - Combined custom formats with culture settings - NULL and empty value handling - Various date formats (ISO, US, EU, short formats) - Timezone format support - Format precedence for ambiguous dates - Regression test for default behavior These tests ensure the fix in issue #43 properly handles edge cases and various date format scenarios. Co-authored-by: Chrissy LeMaire <[email protected]>
Add the allowed_bots input to the anthropics/claude-code-action configuration in the workflow, permitting the claude[bot] account to be recognized as an authorized bot for automated code reviews. No other workflow behavior or secrets were changed.
Update .github/workflows/claude-code-review.yml to change allowed_bots from "claude[bot]" to "*" for the anthropics/claude-code-action. This allows any bot account to be accepted by the action (enabling other bots/integrations to run the code review); consider auditing for security implications if broad bot access is undesirable.
|
had to merge with a failure bc of a change with github actions that requires me committing to main |
Addresses issue #43 where Import-DbaCsv ignores -DateTimeFormats and -Culture parameters.
Root Cause
The issue was in
CsvDataReader.CacheColumnConverters()which always used the default DateTimeConverter instance from the registry, which has no custom formats and uses InvariantCulture.Changes
CsvDataReader.CacheColumnConverters()to create custom DateTimeConverter instances when DateTimeFormats or Culture are specified in optionsTestDateTimeConversionWithCustomFormats()to verify dd/MM/yyyy parsingTestDateTimeConversionWithCulture()to verify Culture parameter supportThis ensures dates like '04/02/2026 15:14:21' with format 'dd/MM/yyyy HH:mm:ss' are parsed correctly as February 4th instead of April 2nd.
Fixes #43
Generated with Claude Code