Commit 1cc609b
Import-DbaCsv - Fix Culture+DateTimeFormats to restore number parsing (issue #10338)
Two issues with the previous fix:
1. The derived format list included LongDatePattern strings (e.g.
"dddd, d. MMMM yyyy HH:mm:ss") that contain locale-specific tokens
(MMMM, dddd). The CsvDataReader library, when iterating these
formats, throws on locale-specific patterns and immediately falls
back to DateTime.Parse without a Culture set -- causing the import
to fail entirely (null result).
2. Removing Culture from csvOptions broke the existing number-parsing
behavior (comma as decimal separator for de-DE/de-CH etc.).
Fix: use only short purely-numeric patterns derived from
ShortDatePattern (e.g. "dd.MM.yyyy HH:mm:ss", "dd.MM.yyyy HH:mm",
"dd.MM.yyyy"). These never cause format exceptions, so the library
uses ParseExact cleanly and returns the correct day/month order.
Also restores Culture on csvOptions so number parsing continues to
work correctly.
(do Import-DbaCsv)
Co-authored-by: Andreas Jordan <andreasjordan@users.noreply.github.com>1 parent 68623ea commit 1cc609b
1 file changed
Lines changed: 8 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
608 | | - | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
609 | 613 | | |
610 | 614 | | |
611 | 615 | | |
612 | 616 | | |
613 | 617 | | |
614 | 618 | | |
615 | 619 | | |
616 | | - | |
617 | | - | |
618 | | - | |
| 620 | + | |
619 | 621 | | |
620 | 622 | | |
621 | 623 | | |
| |||
1370 | 1372 | | |
1371 | 1373 | | |
1372 | 1374 | | |
1373 | | - | |
1374 | | - | |
1375 | | - | |
1376 | | - | |
1377 | | - | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
| 1375 | + | |
1381 | 1376 | | |
1382 | 1377 | | |
1383 | 1378 | | |
| |||
0 commit comments