From 93e389c943a386e76d65fc05c67c775cc1f06885 Mon Sep 17 00:00:00 2001 From: RiRiSharp Date: Sat, 6 Sep 2025 21:56:14 +0200 Subject: [PATCH 1/4] Add DateTime to DateOnly conversion --- .../xlsx/TestIssue869/DateTimeMidnight.xlsx | Bin 0 -> 8483 bytes .../TestIssue869/DateTimeNotMidnight.xlsx | Bin 0 -> 8541 bytes src/Directory.Build.props | 81 +++++++++--------- src/MiniExcel.Core/MiniExcelConfiguration.cs | 29 ++++++- .../Reflection/MiniExcelMapper.cs | 14 +++ .../MiniExcelIssueTests.cs | 35 ++++++++ 6 files changed, 118 insertions(+), 41 deletions(-) create mode 100644 samples/xlsx/TestIssue869/DateTimeMidnight.xlsx create mode 100644 samples/xlsx/TestIssue869/DateTimeNotMidnight.xlsx diff --git a/samples/xlsx/TestIssue869/DateTimeMidnight.xlsx b/samples/xlsx/TestIssue869/DateTimeMidnight.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..19d84975797fb8452d5d537ff603a353363aeea8 GIT binary patch literal 8483 zcmeHMg6Q>lVUTVVq&p?0rE6g5&H;x;KtiNJP*NHx=|;Lcq`O0b-{^Pm zO9KP|AQ}h&5CG5+ zb;Tie&SrMbhUy;nW={I7?zUj6EFdCd1^^L$|G(pZcm@jNdX-w)aV5`Xeu#f#k((_O zLF3tlcH%QVf7aCYrX$}(H_giGHZAl!u2?3KHD4+Iz^oVN;aAHtJKHK~NJpJ2W_UnX zlZF8~A6t9p4t*mDX{@7;_I?H-xd;cTp<$$XGT^O4b*n13#FD67A(FziBe*L=1f$kgATNXC6&6`wIE~jVv8zFj3iS&$kg;lw z<5i;k7bnKgTw^ay5a-!p(GA#h{R=2{U-&2$xyj1%!cOvaI-+eJH+t)Ndp0sgg`cQg z)$$Tq8nWo7i3CtXhbI9lHsKY-MVxj6K5fE8*$TY}EmU*g>6Zv7+7`%7Ytvpwn=0L> zv1MM&=}ePQ7T{xo`hMu@{>DV!8|%;GzjXW` z=HOo*y)af$xs@Fgwl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(%xWW`Aq0UOR&@8u#DZDIx8xdPKGCu9S8MET!c`2(n zPc3S495>RX5wV&_iVmc*qc~0SoSHZCCqqxbu06Of$^0U432fr4nNCe&?h=SD4=j^a zPSnxNv(M#gcq&pc+BpYW65O+ZQd)fxoJqk)?JccpPIjWh5*Sa}AZ0D=)K;g(E6=}k zzVGazf?GCGpV(X-dY*h)R4oF5zB%`=SWL=@irlDsYEqS-e=jMc-qtQAOaODM+Y`vV zfU!yQsiG#v8C1JzGZ9?y3db$L(_T04+@264L+SYL1CsDcjM?$%T6G0IiLUR_T!7pJ z=&MjOk+VU&GdXT~G>Wg?^iNSuzfe1Wg`-{D3f>)i(Ah6?0OvVS6P^un6m=aGGEP;$ zWbwJvWd1S!xzZ!XZ)wjSb*i#zguqc@*Vs|dTCIBMk) zyIwx-I63rwbAf8`MrGi%M&*4|2@P% zig~|#`MqTF%gZeOzZOt_ckp|@`pZE!*-r<*ve(~Df0y`QrbWnlByt*Ee;54UJ^Wot wf7t^7K_H~S{w}P)oBuro{?#0d`Y+~x1VjyGbmZy+0Jo5@K%{o}(ERxJKY2;HH~;_u literal 0 HcmV?d00001 diff --git a/src/Directory.Build.props b/src/Directory.Build.props index d3036196..8a338341 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,45 +1,46 @@ - - - netstandard2.0;net8.0 - 2.0.0-preview.1 - enable - enable - 13 - - - MiniExcel - Mini-Software - excel;xlsx;csv;micro-helper;mini;openxml;helper; - Fast, Low-Memory, Easy Excel .NET processing tool for importing, exporting and templating spreadsheets - Github : https://github.com/mini-software/MiniExcel - Gitee : https://gitee.com/dotnetchina/MiniExcel - Issues : https://github.com/mini-software/MiniExcel/issues - Todo : https://github.com/mini-software/MiniExcel/projects/1?fullscreen=true - Wei Lin, Michele Bastione, PING-HSIU SHIH, Amos(izanhzh), eynarhaji, Mini-Software team - Mini-Software, 2021 onwards - en - Apache-2.0 - https://github.com/mini-software/MiniExcel - https://github.com/mini-software/MiniExcel - Github - icon.png - Please Check [Release Notes](https://github.com/mini-software/MiniExcel/tree/master/docs) - true - true - snupkg - README.md - - - - True - ..\miniexcel.snk - + + net8.0 + 2.0.0-preview.1 + enable + enable + 13 + - - - - + + MiniExcel + Mini-Software + excel;xlsx;csv;micro-helper;mini;openxml;helper; + Fast, Low-Memory, Easy Excel .NET processing tool for importing, exporting and templating spreadsheets + Github : https://github.com/mini-software/MiniExcel + Gitee : https://gitee.com/dotnetchina/MiniExcel + Issues : https://github.com/mini-software/MiniExcel/issues + Todo : https://github.com/mini-software/MiniExcel/projects/1?fullscreen=true + + Wei Lin, Michele Bastione, PING-HSIU SHIH, Amos(izanhzh), eynarhaji, Mini-Software team + Mini-Software, 2021 onwards + en + Apache-2.0 + https://github.com/mini-software/MiniExcel + https://github.com/mini-software/MiniExcel + Github + icon.png + Please Check [Release Notes](https://github.com/mini-software/MiniExcel/tree/master/docs) + true + true + snupkg + README.md + + + + True + ..\miniexcel.snk + + + + + + \ No newline at end of file diff --git a/src/MiniExcel.Core/MiniExcelConfiguration.cs b/src/MiniExcel.Core/MiniExcelConfiguration.cs index e5ec3ea0..7f4fdba2 100644 --- a/src/MiniExcel.Core/MiniExcelConfiguration.cs +++ b/src/MiniExcel.Core/MiniExcelConfiguration.cs @@ -15,4 +15,31 @@ public abstract class MiniExcelBaseConfiguration : IMiniExcelConfiguration /// When exporting using DataReader, the data not in DynamicColumn will be filtered. /// public bool DynamicColumnFirst { get; set; } = false; -} \ No newline at end of file + + /// + /// Sets the options to how and when encountered DateTime values can be converted to DateOnly values. + /// + public DateOnlyConversionMode DateOnlyConversionMode { get; set; } = DateOnlyConversionMode.None; +} + + +/// +/// Specifies how DateTime values should be converted to DateOnly. +/// +public enum DateOnlyConversionMode +{ + /// + /// No conversion is applied; DateOnly values are not transformed. + /// + None, + + /// + /// Converts DateTime to DateOnly by enforcing midnight (00:00:00) as the time component. + /// + EnforceMidnight, + + /// + /// Converts DateOnly to DateTime by ignoring the time part completely, assuming the time component is not critical. + /// + IgnoreTimePart +} diff --git a/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs b/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs index 055da0c2..470964e3 100644 --- a/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs +++ b/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs @@ -150,6 +150,20 @@ public static partial class MiniExcelMapper return newValue; } + if (itemValue is DateTime dateTimeValue && config.DateOnlyConversionMode != DateOnlyConversionMode.None) + { + if (config.DateOnlyConversionMode == DateOnlyConversionMode.EnforceMidnight) + { + if (dateTimeValue.Hour != 0 || dateTimeValue.Minute != 0 || dateTimeValue.Second != 0 || + dateTimeValue.Millisecond != 0) + { + throw new InvalidCastException( + $"Could not convert cell of type DateTime to DateOnly, because DateTime was not at midnight, but at {dateTimeValue:HH:mm:ss}."); + } + return DateOnly.FromDateTime(dateTimeValue); + } + } + var vs = itemValue?.ToString(); if (pInfo.ExcelFormat is not null) { diff --git a/tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs b/tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs index c9a4e98e..1b490fea 100644 --- a/tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs +++ b/tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs @@ -19,6 +19,41 @@ public class MiniExcelIssueTests(ITestOutputHelper output) // private readonly OpenXmlImporter _csvImporter = MiniExcel.Importer.GetCsvImporter(); // private readonly OpenXmlExporter _csvExporter = MiniExcel.Exporter.GetCsvExporter(); + [Theory] + [InlineData("DateTimeMidnight", DateOnlyConversionMode.None, true)] + [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.None, true)] + [InlineData("DateTimeMidnight", DateOnlyConversionMode.EnforceMidnight, false)] + [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.EnforceMidnight, true)] + [InlineData("DateTimeMidnight", DateOnlyConversionMode.IgnoreTimePart, true)] + [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.IgnoreTimePart, true)] + public void TestIssue869(string fileName, DateOnlyConversionMode mode, bool throwsException) + { + var path = PathHelper.GetFile($"xlsx/TestIssue869/{fileName}.xlsx"); + var config = new OpenXmlConfiguration { DateOnlyConversionMode = mode }; + var testFn = () => _excelImporter.Query(path, configuration: config).ToList(); + if (throwsException) + { + Assert.Throws(testFn); + } + else + { + try + { + _ = testFn(); + } + catch (Exception ex) + { + Assert.Fail($"No exception should be thrown, but still one was thrown: {ex.Message}."); + } + } + } + + private class DateTimeSheet + { + public string? Name { get; set; } + public DateOnly? Date { get; set; } + } + /// /// https://github.com/mini-software/MiniExcel/issues/549 /// From 5bb3cd6028a95cedec5d8dc54e2282c4d1424e73 Mon Sep 17 00:00:00 2001 From: RiRiSharp Date: Sat, 6 Sep 2025 22:26:40 +0200 Subject: [PATCH 2/4] Fix issues found by gemini-code-assist --- src/Directory.Build.props | 81 +++++++++---------- src/MiniExcel.Core/MiniExcelConfiguration.cs | 2 +- .../Reflection/MiniExcelMapper.cs | 18 ++--- .../MiniExcelIssueTests.cs | 4 +- 4 files changed, 52 insertions(+), 53 deletions(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 8a338341..d3036196 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,46 +1,45 @@ + + + netstandard2.0;net8.0 + 2.0.0-preview.1 + enable + enable + 13 + - - net8.0 - 2.0.0-preview.1 - enable - enable - 13 - + + MiniExcel + Mini-Software + excel;xlsx;csv;micro-helper;mini;openxml;helper; + Fast, Low-Memory, Easy Excel .NET processing tool for importing, exporting and templating spreadsheets + Github : https://github.com/mini-software/MiniExcel + Gitee : https://gitee.com/dotnetchina/MiniExcel + Issues : https://github.com/mini-software/MiniExcel/issues + Todo : https://github.com/mini-software/MiniExcel/projects/1?fullscreen=true + Wei Lin, Michele Bastione, PING-HSIU SHIH, Amos(izanhzh), eynarhaji, Mini-Software team + Mini-Software, 2021 onwards + en + Apache-2.0 + https://github.com/mini-software/MiniExcel + https://github.com/mini-software/MiniExcel + Github + icon.png + Please Check [Release Notes](https://github.com/mini-software/MiniExcel/tree/master/docs) + true + true + snupkg + README.md + + + + True + ..\miniexcel.snk + - - MiniExcel - Mini-Software - excel;xlsx;csv;micro-helper;mini;openxml;helper; - Fast, Low-Memory, Easy Excel .NET processing tool for importing, exporting and templating spreadsheets - Github : https://github.com/mini-software/MiniExcel - Gitee : https://gitee.com/dotnetchina/MiniExcel - Issues : https://github.com/mini-software/MiniExcel/issues - Todo : https://github.com/mini-software/MiniExcel/projects/1?fullscreen=true - - Wei Lin, Michele Bastione, PING-HSIU SHIH, Amos(izanhzh), eynarhaji, Mini-Software team - Mini-Software, 2021 onwards - en - Apache-2.0 - https://github.com/mini-software/MiniExcel - https://github.com/mini-software/MiniExcel - Github - icon.png - Please Check [Release Notes](https://github.com/mini-software/MiniExcel/tree/master/docs) - true - true - snupkg - README.md - - - - True - ..\miniexcel.snk - - - - - - + + + + \ No newline at end of file diff --git a/src/MiniExcel.Core/MiniExcelConfiguration.cs b/src/MiniExcel.Core/MiniExcelConfiguration.cs index 7f4fdba2..4ed6e31d 100644 --- a/src/MiniExcel.Core/MiniExcelConfiguration.cs +++ b/src/MiniExcel.Core/MiniExcelConfiguration.cs @@ -39,7 +39,7 @@ public enum DateOnlyConversionMode EnforceMidnight, /// - /// Converts DateOnly to DateTime by ignoring the time part completely, assuming the time component is not critical. + /// Converts DateTime to DateOnly by ignoring the time part completely, assuming the time component is not critical. /// IgnoreTimePart } diff --git a/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs b/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs index 470964e3..eabe886c 100644 --- a/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs +++ b/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs @@ -150,18 +150,18 @@ public static partial class MiniExcelMapper return newValue; } - if (itemValue is DateTime dateTimeValue && config.DateOnlyConversionMode != DateOnlyConversionMode.None) + if (itemValue is DateTime dateTimeValue && + config.DateOnlyConversionMode is DateOnlyConversionMode.EnforceMidnight + or DateOnlyConversionMode.IgnoreTimePart) { - if (config.DateOnlyConversionMode == DateOnlyConversionMode.EnforceMidnight) + if (config.DateOnlyConversionMode == DateOnlyConversionMode.EnforceMidnight && + (dateTimeValue.Hour != 0 || dateTimeValue.Minute != 0 || dateTimeValue.Second != 0 || + dateTimeValue.Millisecond != 0)) { - if (dateTimeValue.Hour != 0 || dateTimeValue.Minute != 0 || dateTimeValue.Second != 0 || - dateTimeValue.Millisecond != 0) - { - throw new InvalidCastException( - $"Could not convert cell of type DateTime to DateOnly, because DateTime was not at midnight, but at {dateTimeValue:HH:mm:ss}."); - } - return DateOnly.FromDateTime(dateTimeValue); + throw new InvalidCastException( + $"Could not convert cell of type DateTime to DateOnly, because DateTime was not at midnight, but at {dateTimeValue:HH:mm:ss}."); } + return DateOnly.FromDateTime(dateTimeValue); } var vs = itemValue?.ToString(); diff --git a/tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs b/tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs index 1b490fea..e21ca35a 100644 --- a/tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs +++ b/tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs @@ -24,8 +24,8 @@ public class MiniExcelIssueTests(ITestOutputHelper output) [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.None, true)] [InlineData("DateTimeMidnight", DateOnlyConversionMode.EnforceMidnight, false)] [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.EnforceMidnight, true)] - [InlineData("DateTimeMidnight", DateOnlyConversionMode.IgnoreTimePart, true)] - [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.IgnoreTimePart, true)] + [InlineData("DateTimeMidnight", DateOnlyConversionMode.IgnoreTimePart, false)] + [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.IgnoreTimePart, false)] public void TestIssue869(string fileName, DateOnlyConversionMode mode, bool throwsException) { var path = PathHelper.GetFile($"xlsx/TestIssue869/{fileName}.xlsx"); From 9c417d91096ffb64bdb42e7ed49b6d08e00c9d82 Mon Sep 17 00:00:00 2001 From: RiRiSharp Date: Sat, 6 Sep 2025 22:43:00 +0200 Subject: [PATCH 3/4] Add TimeOfDay readability tweak --- src/MiniExcel.Core/Reflection/MiniExcelMapper.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs b/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs index eabe886c..87aa8d96 100644 --- a/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs +++ b/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs @@ -154,9 +154,7 @@ public static partial class MiniExcelMapper config.DateOnlyConversionMode is DateOnlyConversionMode.EnforceMidnight or DateOnlyConversionMode.IgnoreTimePart) { - if (config.DateOnlyConversionMode == DateOnlyConversionMode.EnforceMidnight && - (dateTimeValue.Hour != 0 || dateTimeValue.Minute != 0 || dateTimeValue.Second != 0 || - dateTimeValue.Millisecond != 0)) + if (config.DateOnlyConversionMode == DateOnlyConversionMode.EnforceMidnight && dateTimeValue.TimeOfDay != TimeSpan.Zero) { throw new InvalidCastException( $"Could not convert cell of type DateTime to DateOnly, because DateTime was not at midnight, but at {dateTimeValue:HH:mm:ss}."); From b6b668a0ac0c70cc2afdd787ab8a4db7e3262b19 Mon Sep 17 00:00:00 2001 From: Michele Bastione Date: Mon, 8 Sep 2025 00:24:57 +0200 Subject: [PATCH 4/4] Moving DateOnlyConversionMode to the Enums folder and renaming the EnforceMidnight option to RequireMidnight --- .../Enums/DateOnlyConversionMode.cs | 20 +++++ src/MiniExcel.Core/MiniExcelConfiguration.cs | 29 +------ .../Reflection/MiniExcelMapper.cs | 13 ++-- .../MiniExcelIssueTests.cs | 75 ++++++++++--------- 4 files changed, 67 insertions(+), 70 deletions(-) create mode 100644 src/MiniExcel.Core/Enums/DateOnlyConversionMode.cs diff --git a/src/MiniExcel.Core/Enums/DateOnlyConversionMode.cs b/src/MiniExcel.Core/Enums/DateOnlyConversionMode.cs new file mode 100644 index 00000000..0955a87b --- /dev/null +++ b/src/MiniExcel.Core/Enums/DateOnlyConversionMode.cs @@ -0,0 +1,20 @@ +namespace MiniExcelLib.Core.Enums; + + +public enum DateOnlyConversionMode +{ + /// + /// No conversion is applied and DateOnly values are not transformed. + /// + None, + + /// + /// Allows conversion from DateTime to DateOnly only if the time component is exactly midnight (00:00:00). + /// + RequireMidnight, + + /// + /// Converts DateTime to DateOnly by ignoring the time part completely, assuming the time component is not critical. + /// + IgnoreTimePart +} \ No newline at end of file diff --git a/src/MiniExcel.Core/MiniExcelConfiguration.cs b/src/MiniExcel.Core/MiniExcelConfiguration.cs index 4ed6e31d..fee2ac1e 100644 --- a/src/MiniExcel.Core/MiniExcelConfiguration.cs +++ b/src/MiniExcel.Core/MiniExcelConfiguration.cs @@ -1,4 +1,5 @@ using MiniExcelLib.Core.Attributes; +using MiniExcelLib.Core.Enums; namespace MiniExcelLib.Core; @@ -17,29 +18,7 @@ public abstract class MiniExcelBaseConfiguration : IMiniExcelConfiguration public bool DynamicColumnFirst { get; set; } = false; /// - /// Sets the options to how and when encountered DateTime values can be converted to DateOnly values. + /// Specifies when and how DateTime values are converted to DateOnly values. /// - public DateOnlyConversionMode DateOnlyConversionMode { get; set; } = DateOnlyConversionMode.None; -} - - -/// -/// Specifies how DateTime values should be converted to DateOnly. -/// -public enum DateOnlyConversionMode -{ - /// - /// No conversion is applied; DateOnly values are not transformed. - /// - None, - - /// - /// Converts DateTime to DateOnly by enforcing midnight (00:00:00) as the time component. - /// - EnforceMidnight, - - /// - /// Converts DateTime to DateOnly by ignoring the time part completely, assuming the time component is not critical. - /// - IgnoreTimePart -} + public DateOnlyConversionMode DateOnlyConversionMode { get; set; } +} \ No newline at end of file diff --git a/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs b/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs index 87aa8d96..7e46339d 100644 --- a/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs +++ b/src/MiniExcel.Core/Reflection/MiniExcelMapper.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using MiniExcelLib.Core.Enums; using MiniExcelLib.Core.Exceptions; namespace MiniExcelLib.Core.Reflection; @@ -150,15 +151,11 @@ public static partial class MiniExcelMapper return newValue; } - if (itemValue is DateTime dateTimeValue && - config.DateOnlyConversionMode is DateOnlyConversionMode.EnforceMidnight - or DateOnlyConversionMode.IgnoreTimePart) + if (itemValue is DateTime dateTimeValue && config.DateOnlyConversionMode is not DateOnlyConversionMode.None) { - if (config.DateOnlyConversionMode == DateOnlyConversionMode.EnforceMidnight && dateTimeValue.TimeOfDay != TimeSpan.Zero) - { - throw new InvalidCastException( - $"Could not convert cell of type DateTime to DateOnly, because DateTime was not at midnight, but at {dateTimeValue:HH:mm:ss}."); - } + if (config.DateOnlyConversionMode == DateOnlyConversionMode.RequireMidnight && dateTimeValue.TimeOfDay != TimeSpan.Zero) + throw new InvalidCastException($"Could not convert cell of type DateTime to DateOnly, because DateTime was not at midnight, but at {dateTimeValue:HH:mm:ss}."); + return DateOnly.FromDateTime(dateTimeValue); } diff --git a/tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs b/tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs index e21ca35a..6bab7c52 100644 --- a/tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs +++ b/tests/MiniExcel.Core.Tests/MiniExcelIssueTests.cs @@ -1,5 +1,6 @@ using System.ComponentModel; using System.Text.RegularExpressions; +using MiniExcelLib.Core.Enums; using MiniExcelLib.Core.Exceptions; using MiniExcelLib.Core.OpenXml.Picture; using MiniExcelLib.Core.OpenXml.Utils; @@ -16,44 +17,7 @@ public class MiniExcelIssueTests(ITestOutputHelper output) private readonly OpenXmlExporter _excelExporter = MiniExcel.Exporters.GetOpenXmlExporter(); private readonly OpenXmlTemplater _excelTemplater = MiniExcel.Templaters.GetOpenXmlTemplater(); - // private readonly OpenXmlImporter _csvImporter = MiniExcel.Importer.GetCsvImporter(); - // private readonly OpenXmlExporter _csvExporter = MiniExcel.Exporter.GetCsvExporter(); - - [Theory] - [InlineData("DateTimeMidnight", DateOnlyConversionMode.None, true)] - [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.None, true)] - [InlineData("DateTimeMidnight", DateOnlyConversionMode.EnforceMidnight, false)] - [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.EnforceMidnight, true)] - [InlineData("DateTimeMidnight", DateOnlyConversionMode.IgnoreTimePart, false)] - [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.IgnoreTimePart, false)] - public void TestIssue869(string fileName, DateOnlyConversionMode mode, bool throwsException) - { - var path = PathHelper.GetFile($"xlsx/TestIssue869/{fileName}.xlsx"); - var config = new OpenXmlConfiguration { DateOnlyConversionMode = mode }; - var testFn = () => _excelImporter.Query(path, configuration: config).ToList(); - if (throwsException) - { - Assert.Throws(testFn); - } - else - { - try - { - _ = testFn(); - } - catch (Exception ex) - { - Assert.Fail($"No exception should be thrown, but still one was thrown: {ex.Message}."); - } - } - } - private class DateTimeSheet - { - public string? Name { get; set; } - public DateOnly? Date { get; set; } - } - /// /// https://github.com/mini-software/MiniExcel/issues/549 /// @@ -3688,4 +3652,41 @@ public void TestIssue809() Assert.Equal(null, rows[0].A); Assert.Equal(2, rows[2].B); } + + + private class Issue869 + { + public string? Name { get; set; } + public DateOnly? Date { get; set; } + } + + [Theory] + [InlineData("DateTimeMidnight", DateOnlyConversionMode.None, true)] + [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.None, true)] + [InlineData("DateTimeMidnight", DateOnlyConversionMode.RequireMidnight, false)] + [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.RequireMidnight, true)] + [InlineData("DateTimeMidnight", DateOnlyConversionMode.IgnoreTimePart, false)] + [InlineData("DateTimeNotMidnight", DateOnlyConversionMode.IgnoreTimePart, false)] + public void TestIssue869(string fileName, DateOnlyConversionMode mode, bool throwsException) + { + var path = PathHelper.GetFile($"xlsx/TestIssue869/{fileName}.xlsx"); + var config = new OpenXmlConfiguration { DateOnlyConversionMode = mode }; + + var testFn = () => _excelImporter.Query(path, configuration: config).ToList(); + if (throwsException) + { + Assert.Throws(testFn); + } + else + { + try + { + _ = testFn(); + } + catch (Exception ex) + { + Assert.Fail($"No exception should be thrown, but one was still thrown: {ex}."); + } + } + } } \ No newline at end of file